GOW III: Shadows

I checked out this session at GDC today - I'll try and sum up the main takeaways (at least for me):

  • Artist controlled cascaded shadow maps, each cascade is accumulated into a 'white buffer' (new term coined?) in deferred style passes using standard PCF filtering

  • Shadow accumulation pass re-projects world space position from an FP32 depth buffer (separate from the main depth buffer). The motivation for the separate depth buffer is performance so I assume they store linear depth which means they can reconstruct the world position using just a single multiply-add (saving a reciprocal).

  • They have the ability to tile individual cascades to achieve arbitrary levels of sampling within a fixed size memory (render cascade tile, apply into white buffer, repeat)

  • Often up to 9 mega-texel resolution used for in game scenes

  • White buffer is blended to using MIN blend mode to avoid double darkening (old school)

  • Invisible 'caster only' geometry to make baked shadows match on dynamic objects

  • Stencil bits used to mask off baked geometry, fore-ground, back-ground characters

The most interesting part (in my opinion) was the optimisation work, Ben creates a light direction aligned 8x8x4 grid that he renders extruded bounding spheres into (on the SPUs). Each cell records whether or not it is in shadow and the rough bounds of that shadow. To take advantage of this information the accumulation pass (where the expensive filtering is done) breaks the screen up into tiles, checks the tile against the volume and adjusts it's depth and 2D bounds accordingly, potentially rejecting entire tiles.

Looking forward to the the rest of the talks, this is my first year at GDC and it's pretty great :)