View Full Version : Ramp Shader

03 March 2008, 11:36 AM
Ramp shader:

The Ramp shader creates ramps (a form of gradient) from color A to color B and value A to value B based on position A to position B in a selected mode. Additionally you can choose different ending behaviour types to either hold the value at the borders, cutoff, repeat the ramp or mirror it.

mode - gives the choice of 4 different ways the ramp can operate
- linear A->B creates a linear ramp from position A to B
- linear A->B->A creates a back and forth ramp that starts with color/value A from position A to ramp to color/value B half way and back to color/value A at position B.
- radial A->B uses position A as center and position B as radius or outer rim.
- radial A->B->A much like linear A->B->A starts and ends with color/value A and uses color/value B half way.

reference obj A - alternative to the fixed location set below the reference object can determin the location of A. However, it is relative to the position entered below.

x, y, z pos - enter a location for color/value A to go from. If a reference object was chosen, it will be a relative offset from where that reference object sits.

behavior type A - determins what happens outside of the defined A/B locations of the ramp.
- hold holds the color/value A outside of position A (before the ramp)
- cutoff stops color and opacity of the ramp shader and eliminates its influence to any shader it hooks into
- repeat simply repeats the ramp again, starting then from color/value B and ramp back to A and so forth
- mirror will mirror repeat the ramp, which means it will go back to color/value B outside of the defined area of ramp.

color A - determins color A
value A - determins value A

gain - gains the ramp (much like a contrast change)
bias - biases the ramp (offsets the center location of the gradient between A and B)

world coordinates - normally position A and B are in local coordinates to what ever the material is applied to. Switching it to world coordinates will ignore local coordinates. Very useful for fog like effects or other things of that nature.

Info from Taron

03 March 2008, 04:07 PM
Very cool!.. The ramp shader creates a very smooth gradient.. but the controls were difficult for me to understand.. thanks for extracting the info from the source :) Big help!


CGTalk Moderation
03 March 2008, 04:07 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.