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?



closed as off-topic by someonewithpc, Ray Mairlot, cegaton, stacker, X-27 the fluffy unicorn Jan 3 '16 at 18:52

  • This question does not appear to be about Blender within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ I'm voting to close this question as off-topic because it's about Blender's source code. $\endgroup$ – someonewithpc Jan 3 '16 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$ – someonewithpc Jan 3 '16 at 15:31

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.


Not the answer you're looking for? Browse other questions tagged or ask your own question.