This is a small stencil shadow demo I wrote when reading the nVIDIA
paper "Practical and Robust Shadow Volumes".
The demo features two animating lightsources over a plane with a
triangle floating above it, properly casting shadows using the zfail
stencil shadow volumes approach.
The code weighs in at 800 lines, and still includes some unused
parts. I implemented this in july 2002, and it took perhaps a day to
get done. The nVIDIA paper includes a lot of source, so this was no
great undertaking, but I guess it may still be interesting for other
coders who have not done this to look at.
You will need GLUT
to compile the code. I have successfully compiled and run the code on
Windows, Linux, OpenBSD and Solaris.
The program may be modified and copied without permission.
Download: iotd-08-28-2003_stencilshadow.tar.gz (5k)