Right now Ogre supports three kinds of shadow mapping (forgetting about the modulative-additive variations):
- Stencil shadows (aka. shadow volumes)
- Shadow maps through Fixed Function
- Shadow maps through shaders
Shadow Maps through FF are just crap. And Stencil shadows... well they're a major pita to maintain.
I'm bringing this up because I'm cleaning the code with my GSoC 2013 and I'm afraid stencil shadows may not be working in it's current state.
Furthermore:
- They take a lot of work
- To my knowledge, this technique is ancient and rarely used.
- My knowledge about stencil shadows is rusty. I wasn't very familiar with its inner working to begin with
Before rushing, let's take at the features:
Stencil Shadows
+ When using FF, for the user turning stencil shadows "just works" (turn them on -> it's already working)
+ They're mathematically stable (very few artifacts, no aliasing)
+ Shadow quality is fixed
- Only hard edges. No soft shadows
- Give a lot of work to maintain engine side; they don't fit flawlessly with normal rendering sequences or advanced compositing work
- Mesh preprocessing is required (though Ogre does a good job on this side and doesn't require maintenance)
- They're slower (on most cases)
Shadow maps (shader based)
+ They're faster (on most cases)
+ Soft shadows, customizable filters.
+ Naturally fit with GPU's normal rendering sequences and compositors.
- Shadow quality depends on light/receiver/camera direction & position
- Artifacts: Aliasing, Shadow Acne, Peter panning.
- Requires the user to have some knowledge of shaders (can be alleviated if stuff like RTSS proves to be successful. Furthermore all APIs are moving to shader-only rendering)
So, long story short, I want to code knowing that if I have to, stencil shadows support can be axed. They're old, hard to support, look fake because of their hard edge, are slower, and rarely used. And they don't fit in an engine using shaders.
Chances are, if you really benefit from Stencil Shadows, you're targeting older machine specs where Ogre 1.x performs fine (not to mention, it could run faster since Ogre 2.x makes assumptions about the hardware, for instance mandatory SSE2 support for x86 builds; also benchmark and tuning is done using latest hw. Cache line sizes & branch predictors changes, single core chips, all can affect the performance between 1.x & 2.x; Ogre 1.x was designed with Pentium III HW in mind)
If a breakthrough causes stencil shadows to be all the rage again, we'll see how to port the 1.x code into 2.x again. But for the foreseeable future, it looks like stencil shadows are dead (there is some stuff I will leave there, for example quite a few users have reported Mesh' edge lists are very useful for their own algorithms, unrelated to shadows; so they're staying)
I would like to know what you think.