Houdini 12 VEX VEX contexts

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.

Globals

Time (read-only)

The time at which the shading occurs, as a number from 0 (shutter open) to 1 (shutter close).

dPdz (read-only)

Floating point step size for volume rendering.

P (read-only)

Position of the point on the surface being shaded. In light or shadow shaders, the P variable contains the point on the light source.

Lz (read-only)

Z-axis in the space of the light. This is a unit vector.

Ng (read-only)

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.

L (read-only)

Vector from the point on the surface to the light source. The length of this vector represents the distance to the light source.

dPds (read-only)

Change in position with respect to the parametric s.

I (read-only)

Direction from the eye to the point being shaded. This may or may not be a normalized vector.

Eye (read-only)

Position of the eye.

dPdt (read-only)

Change in position with respect to the parametric t.

t (read-only)

Parametric t (sometimes called v) coordinate of the surface being shaded.

N (read-only)

Shading normal for the surface.

Cl

Light color.

s (read-only)

Parametric s (sometimes called u) coordinate of the surface being shaded.

Ps (read-only)

Position of the point on the surface being illuminated.