I have implemented zFail realtime shadows into my engine, also known as “Carmack’s Reverse” made famous by John Carmack for the Doom 3 engine.
Here is a before and after screen shot of the same image (Please exuse the ugly models…I’ll get to the real art at some point. ;))
Before
http://vorax.thebodclan.com/images/no_shadow.jpg
After
http://vorax.thebodclan.com/images/shadow.jpg
I am pretty happy with the FPS, but to use the algorithm properly, all my models vertex counts will have to go up a bit because you can’t have unclosed meshes or you get streak artifacts. This algorithm is really a killer on both CPU and video card - it generally drops FPS by more then 50% (I get about 48% drop) because the entire scene is rendered twice and you have to render the shadows to the stencil buffer. I am using the two_sided stencil extension to save some stencil buffer writing but I am gaining something else for free - The way my engine is designed I don’t have to transform the light into the object coordinates, this is a pretty big saving because it either adds alot of CPU or it adds alot of copmlexity it also opens me up to use display lists for static object shadows, another very big saving. Because the engine does all transformations in the second thread, I can keep everything (lights and objects), in worldspace. There is no need to determine the inverse matrix of the objects transformations.
If you look you can see a streak in the shadow, it’s a part that lit just past the leg and into what should be the bulk of the shadow. That’s not a bug in the implementation, it’s caused by a reversed normal insde the model.
Now I have to go back and patch up just about all the models to remove any more reversed normals and close the meshes…just added another month to the project …DOH!