56 4.Screen‐SpaceClassificationforEfficientDeferredShading
This can be done using dynamic shader branches, but that can lead to poor per-
formance on current game console hardware.
Swoboda [2009] describes a technique that uses the PlayStation 3 SPUs to
analyze the depth buffer and classify screen areas for improved performance in
post-processing effects, such as depth of field. Moore and Jefferies [2009] de-
scribe a technique that uses low-resolution screen-space shadow masks to classi-
fy screen areas as in shadow, not in shadow, or on the shadow edge for improved
soft shadow rendering performance. They also describe a fast multisample anti-
aliasing (MSAA) edge detection technique that improves deferred lighting per-
formance.
These works provided the background and inspiration for this chapter, which
extends things further by classifying screen areas according to the global light
properties they require, thus minimizing shader complexity for each area. This
work has been successfully implemented with good results in Split/Second, a rac-
ing game developed by Disney’s Black Rock Studio. It is this implementation
that we cover in this chapter because it gives a practical real-world example of
how this technique can be applied.
4.2OverviewofMethod
The screen is divided into
4
pixel tiles. For every frame, each tile is classified
according to the minimum global light properties it requires. The seven global
light properties used on Split/Second are the following:
1. Sky. These are the fastest pixels because they don’t require any lighting cal-
culations at all. The sky color is simply copied directly from the G-buffer.
2. Sun light. Pixels facing the sun require sun and specular lighting calculations
(unless they’re fully in shadow).
3. Solid shadow. Pixels fully in shadow don’t require any shadow or sun light
calculations.
4. Soft shadow. Pixels at the edge of shadows require expensive eight-tap per-
centage closer filtering (PCF) unless they face away from the sun.
5. Shadow fade. Pixels near the end of the dynamic shadow draw distance fade
from full shadow to no shadow to avoid pops as geometry moves out of the
shadow range.
6. Light scattering. All but the nearest pixels have a light scattering calculation
applied.
7. Antialiasing. Pixels at the edges of polygons require lighting calculations for
both 2X MSAA fragments.