Shadow volumes are relatively new, despite being first proposed in 1977 by computer scientist Frank Crow. It took many years before they could be implemented in real time. The video game Doom 3 was a major implementation that employed John Carmack's version of stencil buffers, now known as Carmack's Reverse or depth-fail method.
The main goal of a shadow volume is to divide a scene into two volumes: the part in light and the part in shadow. To accomplish this, we have to do the following:
Find all silhouette edges, meaning edges that separate back-facing faces from front-facing faces.
Extend all silhouette edges away from the light source.
Optionally add a front-cap or back-cap to each surface to form a closed volume.
This results in something like the following:
These images were generated using a program written by Rainwarrior, the Windows version of which can be downloaded from http://rainwarrior.ca/dragon/effects.html. An explanation about shadow volumes and how to render them...