Stencil Shadow Volumes

Lighting so far ignores other objects: a lamp lights every face turned toward it, even behind a book. A shadow volume is the region of space an object hides from a light, built as real geometry. Drawing that geometry into the stencil buffer, a per-pixel 8-bit counter, marks every visible pixel that lies inside a volume, and the lit pass then skips those pixels. The result is exact to the pixel, with hard edges, at the price of drawing the scene four times.

Subsections