shadow
VEX context

In modern raytracing/PBR rendering, shadows are computed as part
of the normal rendering process, and do not require separate shaders.

In micropolygon rendering, shadow shaders are called from surface or fog shaders to occlude the
illumination from a given light source. The light would have already been
computed by the light shader. The purpose of a shadow shader was to
modify the Cl variable. Typically, the light would be occluded, causing
the Cl variable to decrease in intensity.

You would typically use the shadow context to separate illumination from
expensive ray-tracing calls (like fastshadow or filtershadow). This
allowed fog shaders (or surface shaders) to easily bypass shadow
testing.

Globals

vector

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.

vector

I

Read only

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

vector

dPds

Read only

Change in position with respect to the parametric s.

vector

dPdt

Read only

Change in position with respect to the parametric t.

vector

N

Read only

Shading normal for the surface.

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.

vector

Cl

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

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.

vector

Ps

Read only

Position of the point on the surface being illuminated.

vector

Eye

Read only

Position of the eye.

float

s

Read only

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

float

t

Read only

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

float

Time

Read only

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

Simplex noise is very close to Perlin noise, except with the samples on a simplex mesh rather than a grid. This results in less grid artifacts. It also uses a higher order bspline to provide better derivatives. This is the periodic simplex noise

Simplex noise is very close to Perlin noise, except with the samples on a simplex mesh rather than a grid. This results in less grid artifacts. It also uses a higher order bspline to provide better derivatives.