Shadow Volumes

Shadow Volumes 1   Shadow Volumes 2

Description:

This project displays four tori rotating around a point light source. Each casts shadows on the other tori and on the walls. The effect is acheived in three passes:

  1. Draw entire scene lit by ambient and a small amount of diffuse light.
    This pass also sets the depth values for the visible scene.
  2. Draw shadow volumes into stencil buffer.
    By default the shadow volumes use the "zFail" technique, with an infinite far clip plane, as described in the "Robust Stenciled Shadow Volumes" paper.
  3. Draw scene lit with full diffuse and specular, in unshadowed areas (where stencil == 0).

Several optimisations to the above method are also supported; see the technical information page for details.

Requirements:

For Two-sided-stencil shadows:

EXT_stencil_two_side
EXT_stencil_wrap

For vertex program volume extrusion:

ARB_vertex_program

References:

Practical & Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering, by Cass Everitt and Mark J Kilgard. developer.nvidia.com

Nehe tutorials lesson 28 - stencil shadow volumes. nehe.gamedev.net

Download:

shadvol.zip (150 KB)