Mon Feb 13, 2012 6:30 pm by mh
You could use two-sided stencil with the original code easy enough and there are no patent worries about that. That would halve the fillrate overhead of shadow volumes, but in the Doom 3 implementation the bottleneck is on the CPU not the GPU so it's not that big a deal. At the same time, it seems the sensible thing to do.
Going for the GL2 two-sided stencil implementation (with possible option fallbacks to the EXT and ATI versions) would make sense. It is 2012 after all.
The patent issue doesn't cover that part of it; it covers the z-fail algorithm.
In the common case there is no patent issue - the view is outside of the shadow volume and you can just use normal z-pass. That's a two pass draw with regular stencil (i.e. the released code) or a one pass draw with two-sided stencil (i.e. the original engine or a GL2 mod).
The special case is when the view is inside a shadow volume and that's where the patent issue comes up. In that case your options are to risk the wrath of Creative's lawyers or to play safe. I recommend playing safe, which means it's four passes with regular stencil or two with two-sided stencil. That only applies to drawing any shadow volume that the view is inside; all other volumes (view is outside) will still be drawn as I outlined above.
In normal gameplay it's not tha big a deal. On reasonably modern hardware you probably won't even notice any performance difference. You can pick scenes in the game that do show it up (like the dropship shadow at the very start) but otherwise it's highly unlikely to be ever even happening, or happening for more than 1 or 2 shadow volumes, on any given frame.
There are other things in Doom 3's renderer that are a much more significant performance drain anyway (VBO setup, skeletal animation on the CPU, clearing the stencil buffer in isolation, etc) so time is better spent tackling them rather than worrying over shadows.
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.