1
$\begingroup$

Alright, currently I have a color gradient somewhat hacked together with a Divide node and based on object location like this:

enter image description here

What I want is this - a 4-5 color gradient based on object location (so it can be split among the cubes) and not oddly hacked w a Divide node:

enter image description here

Ive tried plugging Object location directly into color ramp but am not having luck/cant scale the gradient. How can I do this?

$\endgroup$
2
  • $\begingroup$ Try using a map range node with the "From Max" value set to the highest x-value of an object. $\endgroup$ Oct 30, 2020 at 21:24
  • 2
    $\begingroup$ Hi. Don't get exactly what you want to do from what you have. Is it to get rid of the division? Or because some element reach the colorramp limits? $\endgroup$
    – lemon
    Oct 31, 2020 at 8:37

1 Answer 1

0
$\begingroup$

In order to achieve this you need to take account of both the X and Y location - your current example is only using X from the Separate XYZ node.

Something like the following should do the trick :

nodes

Here the X and Y are used to generate the Red and the Green channel of the resultant color and the Blue is generated using some maths to color from the opposite corner of the range (ie, subtract each of X and Y from 1 to invert the range and use the minumum to combined them). The two Value nodes are used to control the Range of the fade (the one on the Mapping node) and the spread of the colors (the ones connected to the Power nodes). The start location of the range any any rotation can be controlled via the Mapping node.

This produces the following result :

result

To get different mix of colors you can adjust the maths to something more complicated. You could potentially add a Color Ramp before each input of the Convert XYZ node to give you more visual control of the result (with each controlling the level of that channel via gray-scale values).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .