RSL
|
IntroductionThe shaded features of micro-polygons, such as their position, color and opacity, are often determined by their location in the 'st' or 'uv' texture space. For example, listing 1 shows a surface shader that uses the sin() function, based on 's', to generate a cyclic pattern - figure 1. Listing 1 (simple_sine.sl)
Of course, if the shader is attached to geometry that has not been assigned texture coordinates the result of using 's' becomes problematic - figure 2.
Even more unpredictable are geometries that cannot be given texture coordinates. For example, the volumetric cylinder shown in figure 3 and the Blobby in figure 4.
The next section demonstrates that shading according to 'xyz' position, rather than texture coordinates, generates a 3D solid texture. |
A 3D Sinusoidal Texture
Rather than calculating a sine value based on a texture coordinate, such as 's',
the polar coordinate of a shading point (generally a micro-polygon) can be used.
For example, the angular position (theta) of Listing 2 (sine3d.sl)
Figure 6 shows the sine3d shader assigned to a cylinder, a volume primitive and a blobby. |
|
© 2002- Malcolm Kesson. All rights reserved.