shadow_stencil

Determines the type of dynamic shadows cast by models. Must be set before level loading.

Range:

-1 - No dynamic shadows.
0
- Decal shadows (default). 7.66
1 - A7 Z-pass stencil shadows. A8 Accelerated z-pass stencil shadows.
2 - A7 Z-fail stencil shadows. A8 Accelerated z-fail stencil shadows.
8 - Script-based shadows (such as PSSM shadows).

Type:

var

Remarks:

Decal shadows are no 'real' shadows, but just a diffuse darkness on the surface underneath the shadow throwing object, regardless of any light sources. Stencil shadows are real shadows cast from the sun or the closest light source. Due to the hard shadow edges, especially with self shadows, they look best in levels with strong light contrasts. They can be blurred with a postprocessing shader. Both types of shadows follow the ground shape and can bend around edges.

General decal shadow Individual decal shadow Stencil self-shadow
Stencil without self-shadow Poisson blurred stencil shadow PSSM self-shadow

Some remarks about decal shadows:

Some remarks about stencil shadows:

Example:

#include <mtlView.c> // contains the stencil_blur() function
...
function main()
{
  ...
  shadow_stencil = 2; // activate z-fail stencil shadows
  shadow_lod = 2; // use the second LOD stage for stencil shadows
  stencil_blur(1); // activate blurred shadows
...

See also:

SHADOW, CAST, shadow_lod, shadow_range, shadow_threshold, render_stencil, shadow

► latest version online