Stencils Shadows

Deano Calver

Newcomer
Dave asked me about Stencils on PM, this was my reply (slightly edited for public consumption) that he suggested other people might be interested in, so here it is.
------------------------------------------------------------------

I've been a shadow map fan for a long time, so I'm slightly biased, but even though everybody agrees that shadowmap are the long term solution, stencil will be around for a while yet.

The biggest problem rearing its head is the serialization problem, unless you copy stencil to texture your left only able to 'process' one light at a time. Its a total killer in PC space, its the one of two reason the Crytek guys couldn't get any real mileage out of SM3.0. Copy stencil-to-texture operations use a fair bit amounts of RAM and bandwidth (4 lights per extra framebuffer). You can at least do a screen space blur fairly cheaply (in future just copying data around won't be efficient). One idea I haven't yet played with is using the depth value stored in the depth/stencil to do a DOF style circle of confusion blur, it will be worth if it I can use the depth in the depth buffer (if I have to store the depth it would use to much bandwidth).

Next problem is hardness, just blurring looks fairly horrible and penumbra wedges have real problems in practise. The problem is that on sharp edges the generated penumbra shadows snap. If you have long flat things (like walls, steps, etc.) one moment they are completely in shadow, the next out.

And lets not mention fillrate... For some reason people think the double stencil rate means this isn't a problem. :oops: CPU beam-trees (Doom3 style) can help alot here but it just doesn't scale with polygon count.

But the aliasing and memory problems with shadow-maps aren't going away... We currently use a hybrid system (environment uses a stencil, with horrible copy on PC) but the fill-rate costs of the stencil are a total killer, we've taken to running them at half screen res and that looks horrible. Even with a 2048x2048 FP24 conventional shadow map, aliasing is obvious for fairly 'reasonable' shadow frusta.

We are going to look at perspective shadow maps (we used them with Sudeki (at least we did when I left in Feb) with fairly good results but then they stopped not far from the camera...) but we don't have good solution yet and thats with the advantage of targetting consoles where we should get lots of low level tricks.

Ask me about two years time, I might have a better answer :)
 
Back
Top