Color ramp with UV Texture coordinate

NB! i would like an explanation on why this happens, not just the solution

ok here is the setup, i got a color ramp using the UV coordinates. the object is a plane, and its UV mapped to fit the square texture as seen below.

But in order for the color ramp to act as expected on the plane, i have to adjust the color ramp to about 50% as seen in this image:

isnt that the whole point of using the UV map? i mean sure the plane is 2x1 in size, but the object is scaled to 1:1:1 and the UV map has been mapped to cover the whole texture area.

so my question is, why does this happen? why isnt it applying the color ramp as it should
and how do i make it do so?

Attachments



so a vector (purple slot) contains information about 3 channels. the colour ramp, has a float input, which contains information about 1 channel.

What is happening when you connect a purple slot to grey slot is that it converts the 3 channels into one… as in it adds them together and divides by 3. Thats why without the rotation it is going in a diagonal line. and thats why you need to make the colour ramp go to 0.5 instead of 1

What you should do is either use the wave texture for this… or use the separate XYZ node and use a specific channel. that way it will map properly & wont be influenced by other channels.

uv map is like a range of values from -1 to 1 thats why this is happening. If you add 1 and divide this by 2. You will get 0 to 1 values. So it will be black to white. Now if you use color ramp you will get full range.

“when you connect a purple slot to grey slot is that it converts the 3 channels into one… as in it adds them together and divides by 3.” - as far as i know it will take first value and wont do any math operations

thank you both for the details, could not have asked for more. perfect! Big thanks to both of you.

now i understand more about the purple/gray channels too, that will help me in the future.
indeed, using a separate node, and using X or Y lets me chose if i want it to go horisontal, or vertical on the plane.

Attachments



“when you connect a purple slot to grey slot is that it converts the 3 channels into one… as in it adds them together and divides by 3.” - as far as i know it will take first value and wont do any math operations

Actually it will treat any 3 value type (RGB and XYZ) as a color, and convert it to greyscale based on its luminance.
(L= 0.2126 * R + 0.7152 * G + 0.0722 * B)

Unfortunately Color Ramp doesn’t calculate luminance. It doesn’t put weights on channels. It treats all channels the same. It simply takes the average of all channels, i.e.: (R+G+B)/3.
I don’t like this behavior.
IMHO it SHOULD calculate luminance, lightness or value.

Did some digging in the source code, to check it… You’re quite right, Bartek… but it was funny to find, that Cycles does the conversion differently from colors and from vectors.

Vectors are converted to float using the average. But colors are still converted using Luminance.

did a small test converting a vector into a color using the RGBmix and feeding it into the ‘Color Ramp’… The output differs.

Really? OMG… So it’s more messed up than I thought… Good to know, thanks.

—edit—

On the other hand this behavior is not that bad… Why would you put weights on vector values? It makes sense to calculate luminance for colors, but for vectors… not really…
So in fact it’s not “messed up”… It’s rather smart.

at least, now we know it, we can take advantages from this!! :smiley:

Edited:specially as we use so much the RGBmixer to deal with coordinates :slight_smile: