260 III Bending the Pipeline
of light sources and types. In addition, I will provide measurements about how the
shadow map resolution affects the performance of the traditional method and our
Performance measurements are executed both for client-side and server-side work-
loads because, besides decreasing the geometry processing requirements of shadow
rendering, the technique also drastically decreases the number of necessary state
changes and draw commands to render multiple shadow maps, thus providing an
edge for CPU-bound applications.
While the technique primarily targets OpenGL 4.x–capable GPUs, we present
how the same technique can be implemented with some caveats for GPUs with only
OpenGL 3.x capabilities.
Further, I will present some special use cases of layered shadow map rendering
that can be used to render shadow cube maps and cascaded shadow maps with a single
draw call, and I will brieﬂy present how the technique can be altered to accelerate the
generation of reﬂection maps and reﬂection cube maps in a similar fashion.
F inally, I will discuss the limitations of the presented algorithm, explicitly men-
tioning those imposed by hardware limitations of GPU implementations.
19.2 Traditional Shadow Map Rendering in
Shadow mapping or projective shadowing is an image-space rendering technique in-
troduced by [Williams 78] that became the de facto standard for performing shadow
rendering in real time and ofﬂine graphics applications.
The principle of shadow mapping is that if we view the scene from a light source’s
position, all the object points we can see from there appear in light and anything
behind those is in shadow. Based on this, the algorithm works in the following way:
• We render the scene from the light source’s point of view to a depth buffer
using the well-known z-buffer visibility algorithm.
• When we render the scene from the camera’s point of view, by comparing the
distance of the light source to any point of the surface with the sampled value
from the depth buffer corresponding to the point, we can decide whether the
given point is in light or in shadow. See Figure 19.1.
Modern graphics processors provide hardware support for this technique in the form
of two features:
• Providing a mechanism to store depth-buffer images in textures.
• Providing a mechanism to compare a reference depth value with a depth value
stored in a depth texture.