For some time now, I’ve been using stencil shadows as my go-to solution for shadowing characters and environments uniformly. More recently, I’ve decided to abandon stencil shadows and start researching shadow maps more in depth. It is kind sad to see hundreds; potentially thousands, of lines of code being deleted. The two techniques are so drastically different that it is nearly impossible to re-use any part of the stencil code.
Various Stencil Shadowing Code Snippets; gone.
- Generating and store edge lists and connection information per model.
- Dynamically re-calculating face planes for each triangle.
- Silouette detection and volume edge extruding.
- Dynamic volume construction with near and far caps.
- Precomputed optimal shadow volume construction during map export.
- Stencil shadow volume rendering code, z-pass and z-fail.
- Numerous stencil shadow hardware optimization features (z culling, light clipping, scissoring).
All of these features will likely be replaced by 1 source file that generates a depth texture from the visible geometry. I wonder how many hundreds of hours I spent writing and debugging all of that code. It’s insane, but it was a fun lesson to learn. Now it’s time to leave the legal baggage behind and move on to a more common industry standard.