2.3 Handling resampling errors
2.3.2 Improved sampling methods
2.3.2.3 Partitioning algorithms
Partitioning algorithms use multiple shadow maps to control the shadow map sample dis- tribution. Several algorithms use an approach which we call z-partitioning, where the view frustum is partitioned along its z-axis (view direction) into subfrusta and a separate shadow map is rendered for each one. Plural sunlight buffers (Tadamura et al., 1999) use this ap- proach for offline rendering of shadows from the sun with penumbrae. They partition the view frustum at intervals that increase geometrically with distance from the eye. Cascaded shadow maps (Engel, 2007) use a similar technique but are intended for use with real-time applications. Parallel-split shadow maps (PSSMs) (Zhang et al., 2006a) partition the view frustum using the average of the split locations generated by using geometric and uniform intervals.
Kozlov (2004) uses a cube map in the post-perspective space of the camera as a way to improve PSMs. A separate shadow map is fit to the back faces of the unit cube of the post-perspective view frustum. In world space this is equivalent to fitting perspective-warped shadow maps to side faces and standard shadow maps to end faces. We call this face par- titioning. The benefit of this approach over single shadow map warping is that the warping can be used for all light positions.
z-partitioning and face partition are based solely on the view frustum and do not take into account the positions and orientations of surfaces in the scene. Adaptive partitioning schemes can take these factors into account in order to refine the shadow map where the resolution is needed most, and therefore tend to produce higher quality shadows.
Adaptive shadow maps (ASMs) (Fernando et al., 2001) represent the shadow map as a quadtree of fixed resolution tiles. The quadtree is progressively refined near shadow edges. Each iteration, the algorithm renders the scene, encoding polygon IDs in the color channels using a special mipmap texture to encode the projected area of a shadow map texel in the alpha channel. The resulting image is read back and analyzed using a cost metric to determine where the shadow map should be refined.
Resolution matched shadow maps (RMSMs) (Lefohn et al., 2007) also use a quadtree to store shadow map tiles. Unlike ASMs, however, the quadtree is not iteratively refined at
shadow edges. Instead, an entire quadtree with sufficient resolution at every pixel is produced every frame. The view from the eye is first rendered using a fragment program that encodes for each pixel a request for a tile of sufficient resolution, referred to as a page. The page requests for adjacent pixels on the same surface are likely to be the same. RMSMs leverage this coherence to efficiently remove duplicate page requests before reading them back to the CPU. Spatially adjacent pages are then grouped together by binning them into superpages. The algorithm renders the superpages and copies out the relevant pages into the quadtree. RMSMs have several advantages over adaptive shadow maps. RMSMs perform the scene analysis on the GPU which greatly reduces the size of the readback. ASMs reduce this cost by rendering a lower resolution image, but this can cause some shadow edges to be missed. The RMSM algorithm is also more suitable for dynamic scenes. The quality of ASMs may be quite low when the light moves because the quadtree is invalidated every frame and a large number of frames are required before the quality converges. By not refining at shadow edges, RMSMs trade-off faster generation of high quality shadows at the cost of increased memory requirements.
Queried virtual shadow maps (QVSMs) (Giegl & Wimmer, 2007b) are another adaptive partitioning scheme based on a quadtree refinement. QVSMs first render the shadows using a single shadow map tile at the root of the quadtree. The shadow map is refined into 4 subtiles and the shadows are updated each subtile. Occlusion queries are used to count the number of pixels that change their value. Subtiles are further refined until the number of changed pixels drops below a user specified threshold. QVSMs also use warping (LiSPSM) to achieve better quality. To avoid the high cost of repeated scene renderings, QVSMs use a variation of the deferred shading, using an eye-space depth buffer to compute the positions of shadow map queries. While this approach can offer greater flexibility, it also means that tiles cannot be cached and reused over multiple frames.
Fitted virtual shadow maps (FVSMs) (Giegl & Wimmer, 2007a) use a noniterative quadtree partitioning similar to RMSMs, except that the quadtree is more coarse grained. RMSMs use a tile size of 32×32. FVSM uses tiles up to the size of the largest allocatable texture (4096×4096). The scene analysis is carried out on the CPU using the information encoded
in an image that is read back from the GPU. The benefit of doing the analysis on the CPU is that more sophisticated algorithms can be used to determine where to refine the quadtree. The encoded image is rendered at low resolution (256×256) to minimize the cost of the readback, but this can cause important information to be missed, leading to errors. Like QVSMs, FVSMs use deferred shading for the shadows.
Tiled shadow maps (Arvo, 2004) are an adaptive scheme that partition a single, fixed- resolution shadow map into tiles of different sizes guided by an error measurement heuristic. This results in simpler data structures, but can cause some tiles to be overly compressed or elongated along one or both directions. Chong (2003) presents an algorithm for rendering 1D shadow maps in a 2D scene that uses a greedy partitioning scheme combined with optimized warping to minimize an error metric. Unfortunately, this approach is more difficult to gener- alize to 3D. Forsyth (2006) proposes a partitioning technique that clusters objects requiring similar sampling densities into multiple light frusta using a greedy algorithm. However, this method is based only on distance from the light source and therefore does not handle aliasing due to surface orientation.