Define a shadow shader by defining a program that’s called from surface or fog shaders to calculate the occlusion on a surface from a light source.
Shadow shaders are called from surface or fog shaders to occlude the illumination from a given light source. The light will already have been computed by the light shader. The purpose of a shadow shader is to modify the Cl variable. Typically, the light will be occluded, causing the Cl variable to decrease in intensity, however it is possible to create “negative” shadows that increase the illumination due to occlusion.
You will typically use the shadow context to separate illumination from expensive ray-tracing calls (like fastshadow() or filtershadow()). This allows fog shaders (or surface shaders) to easily bypass shadow testing.
The time at which the shading occurs, as a number from 0 (shutter open) to 1 (shutter close).
Floating point step size for volume rendering.
Position of the point on the surface being shaded. In light or shadow shaders, the P variable contains the point on the light source.
Z-axis in the space of the light. This is a unit vector.
Geometric normal for the surface. This normal represents the “true” normal of the surface being shaded. For example, with Phong shading, the N variable represents the interpolated normal, while the Ng variable represents the true polygon normal.
Vector from the point on the surface to the light source. The length of this vector represents the distance to the light source.
Change in position with respect to the parametric s.
Direction from the eye to the point being shaded. This may or may not be a normalized vector.
Position of the eye.
Change in position with respect to the parametric t.
Parametric t (sometimes called v) coordinate of the surface being shaded.
Shading normal for the surface.
Parametric s (sometimes called u) coordinate of the surface being shaded.
Position of the point on the surface being illuminated.