GPU Gems 3

GPU Gems 3 is now available for free online!

Please visit our Recent Documents page to see all the latest whitepapers and conference presentations that can help you with your projects.

You can also subscribe to our Developer News Feed to get notifications of new material on the site.

Part II: Light and Shadows



The subject of light and shadows may appear simplistic, but in reality it concisely represents what modern rendering is all about. Modeling light visibility is fundamental and sublime in the field of computer graphics. After all, it is the subtleties of reality that we strive most fervently to capture—the fine differences that allow the human eye to accept what is being presented as more than just a simulation. With the rise in popularity of programmable shading and the refinement of highlevel shading languages, we have come a long way from static light maps and projected shadows, so this part of the book presents six chapters that are the state of the art in representing the interplay of light and shadow.

The shadow map is the primary light visibility tool currently used in real-time applications. The simplicity of the algorithm is what makes using shadow maps so attractive. At the same time, the latest applications require more than a pedestrian point light. Shadow-map filtering has long been used to mitigate shadow-map aliasing. Today filtering is used to simulate the effect of area lights. With some clever filtering, plausible soft shadows can be constructed from a shadow map using algorithms such as percentage-closer soft shadows. Large filter kernels needed for area light simulation are expensive because each shadow-map sample must be compared against the shaded fragment's distance from the light. One method for accelerating this, introduced in 2006, is variance shadow maps (VSMs), which can be prefiltered. In Chapter 8, "Summed-Area Variance Shadow Maps," Andrew Lauritzen of the University of Waterloo presents a detailed explanation of VSMs and introduces a method for changing the filtered kernel arbitrarily per pixel.

Offline rendering does not have the same time constraints as, say, a first-person shooter. Time is still important, though, and making full use of the computing resources at hand is critical as the complexity of the rendering algorithms and scenes increases. When artists need to iterate on scenes many times to achieve the desired effect, it is critical that each iteration have the highest possible performance. To meet this requirement, relighting engines have been developed that make assumptions about the scene, such as the camera position not changing, to accelerate each step of the lighting refinement. In Chapter 9, "Interactive Cinematic Relighting with Global Illumination," Fabio Pellacini of Dartmouth College, MiloU0161.GIF HaU0161.GIFan of Cornell University, and Kavita Bala, also of Cornell, present how to use the GPU to achieve much faster relighting than was possible with a CPU.

An issue that haunts many shadow map implementations is the limited resolution of the shadow map. Because a shadow map discretizes a continuous function of depth, aliasing is inherent without infinite resolution. Compounding the problem is the lack of correlation between the distribution of samples in the shadow map and the distribution of fragments in the final scene. It is therefore imperative that the limited resolution of the shadow map be used properly. In Chapter 10, "Parallel-Split Shadow Maps on Programmable GPUs," Fan Zhang and Hanqiu Sun of The Chinese University of Hong Kong and Oskari Nyman of Helsinki University of Technology present an intuitive approach to partitioning the resolution for shadow mapping to more correctly map to the actual usage.

Although shadow maps have received much attention, they are not perfect, and their limitations are unacceptable for some applications. The most widely accepted alternative for real-time dynamic shadows is stencil shadow volumes (SSVs). Like shadow maps, SSVs have been well studied and have been shown to be an elegant solution to the aliasing problems that plague shadow maps. Because the complexity of SSVs is tied to the complexity of the shadowing geometry, robust and fast SSVs have been a topic of much research. With Chapter 11, "Efficient and Robust Shadow Volumes Using Hierarchical Occlusion Culling and Geometry Shaders," Martin Stich of mental images and Carsten Wächter and Alexander Keller of Ulm University show how to handle many of the SSV "gotchas" and detail a system that can even handle nonclosed meshes.

Beyond modeling local lighting with shadow maps or SSVs, current applications demand global illumination techniques that provide more immersive sensory feedback by taking into account the entire scene. Several techniques, from radiosity to precomputed radiance transfer, can achieve good results for static scenes but are difficult to adapt to the dynamic world of a game. Hybrid techniques that combine traditional real-time dynamic lighting models for local lights, along with some representation of the global lighting contribution, will be used more frequently to achieve greater realism without sacrificing too much performance. One such technique, which works well to simulate the contribution of a distant light such as the sun, is ambient occlusion. Real-time ambient occlusion is possible today, even for dynamic scenes, but it suffers from several artifacts caused by approximations assumed in Michael Bunnell's original approach (which appeared in GPU Gems 2). Chapter 12, "High-Quality Ambient Occlusion" by Jared Hoberock and Yuntao Jia of the University of Illinois at Urbana-Champaign, builds upon Bunnell's work and robustly and efficiently solves many of these artifacts.

Chapter 13, "Volumetric Light Scattering as a Post-Process" by Kenny Mitchell of Electronic Arts, tackles the topic of modeling light as it travels through morecomplex mediums. Often called "god rays," this effect that the atmosphere has upon light transport adds more believability to outdoor scenes. This chapter presents a functional approach to estimating such scattering with a postprocess shader, which properly handles occlusion by opaque objects such as large buildings.

Kevin Myers, NVIDIA Corporation

Developer Site Homepage

Developer News Homepage

Developer Login

Become a
Registered Developer

Developer Tools




GPU Computing


Events Calendar

Newsletter Sign-Up


Jobs (1)


Legal Information

Site Feedback