RSL
|
Introduction
The function |
|||
smoothstep(0.3, 0.6, 0.4); smoothstep(0.3, 0.6, 0.8); |
Applying SmoothstepAs shown on the right the smoothstep function can be used to control the blending colors or a displacement. The code for the displacement shader is shown in listing 1.
|
Listing 1
|
Combining Smoothsteps - part 1
Often a shader must control a blending factor by smoothly
increasing and decreasing an effect. For example,
in the case of the displaced cylinder the min and
max values might be used to define locations
where a displacement is ramped-up then ramped-down.
blend = smoothstep(0.2, 0.3, t) * (1 - smoothstep(0.6, 0.7, t);
|
|
|
Combining Smoothsteps - part 2
The double ramping seen in the previous section can also be
achieved in two directions, say, in ' blend = smoothstep(0.2, 0.3, s) * (1 - smoothstep(0.6, 0.7, s) * smoothstep(0.2, 0.3, t) * (1 - smoothstep(0.6, 0.7, t); |
|
|
© 2002- Malcolm Kesson. All rights reserved.