Color ramp acting weird

I’d like to use the color ramp as a contrast node (make an input texture’s darkest spot (eg. value: 0.2) output value:0, and the brightest spot (eg. value: 0.6) output value: 1. I thought it was easy, just set the color ramp positions the current darkest and brightest values, then output black and white. Turns out it’s not working for some reason:



On the first shot, the UV/Image editor says the value of a relative dark spot is 0.23, so I set color ramp position to .22. On the other end of the ramp there’s white, so it should output a high contrast black and white image. It turns black.

On the second image it outputs the desired resutls, but color ramp settings are odd (dark spot .05)

Am I not using it right or is it really not working?

Hi,

I think that when you connect the “colour” output of the image texture to the “fac” input of the colour ramp node the conversion is more complex than you suggest.
Instead of converting the colour to the fac by simply taking the value component of the HSV I think that the hue and saturation must be included as well
Hence the colour ramp is not from 0.23 as you think but some other value

As an illustration consider the following material.
If the implicit colour to fac input conversion was the same as the explicit operation of the colour to black and white node, there would not be any difference in the output.


Best of luck

Martin

Hey,

Thanks for the input, and sorry for coming back to the thread after days.

Tried your node setup, and turned out, if you set the factor of your difference mix node to 1, there’s actually no difference at all (output is solid color), so I still believed it should work. Well, it does :smiley: All you have to do is to set the color mode to “non-color data” from “color”, and then the texture acts precisely as expected and described above in my post. Only question it leaves is why does it display different values with color and non-color?