# How does the color ramp work in Cycles?

How does the color ramp work in Cycles?:
I had only been using the blender internal and have suddenly set foot on cycles which turns out to be a 90% node based for materializing and almost anything. Being a non-programmer and self-taught up to this point both in blender and GIMP, I'm having trouble in every node in cycles except the shaders and textures. Specially for this part of the question, would anyone be kind enough to explain me how the "color - ramp" node works???
It appears to be very different than the BI.

The color ramp maps values to colors.

A black and white picture is made up of a bunch of pixels, each with a value between 0 and 1, where 0 is black, 1 is white and 0.5 is half way between, etc.

What the color ramp node does, is it takes a black and white input (if you input a color image, it will convert it) and re maps each pixel to a new value.

If a white pointer on the color ramp is at postion 0.5, then a value at 0.5 will be mapped to white.

To see this in action, lets look at two color ramp nodes:

The one on the top represents an un modified image, white goes to white, black goes to black, grey goes to grey.

The one on the bottom is a modified image, everything about .5 grey goes to white.

We will now have a little 3 pixel demo image:

[.25][.5][.75]

The first pixel is at 25% grey, the next at 50% grey and the last at 75% grey. Lets see what the lower color ramp will do to each of these pixels.

### .25

The first pixel, at point two five will get mapped to .5. The reason is that it is half way between a white and a black point, and since the color fade is linear, the half way value will be .5.

### .5

The pixel at .5 lands directly on the white pointer, and therefore is set to 1.

### .75

The .75 valued pixel lands past the white pointer, between it and the end. This means that it will also be set to white, a value of 1.

What I would do now is put some images through the color ramp, using the image texture node, and just play around until you get the hang of what effect it is having.

Footnote The pixel at .25 would not have the value if the interpolation was not set to linear. For the sake of understandably I won't mention interpolation in detail, leave it a the default until you get the hang of things.

• Maybe a node setup showing bump mapping with the color ramp node would give a good visual representation of what the values achieve
– Neil
Nov 30, 2015 at 20:54
• If black represents a value of zero and white a value of one(scalar values) then what would other colors like red, green etc,. represent scalar values of?
– bzal
Dec 1, 2015 at 13:42
• If the default color ramp equal to the convert RGB to BW node?
– bzal
Dec 1, 2015 at 13:43
• I meant that you can switch to different colors in the node itself, therefore if I change the black to red for instance and white to green then what would happen to the mapping values???
– bzal
Dec 1, 2015 at 14:14
• @bzal Yes, it converts to black and white, in its default state. You can set pointers to equal different colors, and like you said, set white to green, and black to red. Dec 1, 2015 at 15:38