I'm not savy with browsing Blenders source code. For another purpose I'm interested in the source code of the color ramp node.

Not the UI stuff of it, just the "math" behind it, the "take in everything, from a single number up to a complete bitmap, and remap those values according to the sliders count, color and position".

Anyone that's into Blenders source code can help me out and post the code of the color ramp node? Or maybe directions so I can find it myself?


  • 4
    $\begingroup$ I'm voting to close this question as off-topic because it's about Blender's source code. $\endgroup$ Jan 3, 2016 at 15:27
  • 2
    $\begingroup$ If you're using Gnu/Linux or some other Unix version, you can just use the command grep. For instance, grep -r 'colorRamp' .. In windows there's findstr $\endgroup$ Jan 3, 2016 at 15:31

1 Answer 1


The code you're looking for is here on line 322 (the do_colorband function).

This is the definition of the node itself, and the operation is implemented here: apparently it samples a colourband texture using the input as texture coordinates.

  • $\begingroup$ unfortunately these links have partially rotted. $\endgroup$
    – stib
    Aug 11, 2021 at 4:05

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