RSL
|
IntroductionThis tutorial provides code that demonstrates how values calculated in a displacement shader can be accessed by a surface shader - both shaders must be assigned to the same surface. For example, figure 1 shows the effect of a surface shader that querries the displacement values in order to assign white to the peaks of the bumps.
The Pixar documentment that deals with this topic is,
|
Data Out/Data inThe code for a pair of shaders is shown below (listings 1 & 2). The first shader outputs a value called hump so that the surface shader can create the illusion of snow - figure 1. Although the shaders are far from sophisticated, they are a good starting point for developing cooperating shaders that could generate very interesting visual effects. |
Listing 1
|
Listing 2
|
Output Values Min/Max
Because the output value in listing 1 is equal to
If a single value is written by the
Once the range of values is known remove or comment the printf statement in the shader source code. |
© 2002- Malcolm Kesson. All rights reserved.