Real-time Shadow Algorithms and Techniques


Shadowing Information from NVIDIA

Shadowing is a key component for convincing, solid-looking rendering. Whether hard or soft, physically correct or perceptually satisfying, NVIDIA has been at the forefront of real-time shadowing technology. This page collects some of the shadow-related presentations and white papers created in recent years by NVIDIA developers.

Hard Shadows | Soft Shadows | Ambient Occlusion | Raytracing

Hard Shadows

Fast, Practical, and Robust Shadow Volumes
White Paper and Sample Demo, 2004
Combining efforts from Brown University and NVIDIA Corporation, this paper presents a set of algorithms for rendering shadows using the stencil buffer and the shadow volume technique. Using a series of techniques for culling, clipping, and simplifying shadow volume geometry, it is possible to achieve greater performance than previous methods. The algorithm builds on previously published algorithms by Crow, Everitt and Kilgard, and Lengyel.
Samples from NVIDIA Graphics SDK 10.5:
Cascaded Shadow Maps (Whitepaper)
This sample illustrates cascaded shadow mapping with the use of texture arrays in OpenGL with GLSL.
Volume Light (Whitepaper)
Volume Light technique can be considered a simple approximation of real world light scattering effect.
Samples from NVIDIA Graphics SDK 9.52:
HLSL Hardware Shadow Map
This effect shows generating texture coordinates for shadow mapping, along with using the shadow map in the lighting equation per pixel.
Stencil Shadow Volume Extrusion
In this sample, vertex shaders are used to extrude polygon objects into stencil shadow volumes. This avoids the CPU cost of computing shadow volumes and updating the shadow volume vertex buffers. It requires more memory to store additional face vertices and zero-area triangles for the automatic shadow volume extrusion.
Perspective Shadow Maps (User Guide)
This sample demonstrates hardware-accelerated large-scale perspective shadow maps, using Simon Kozlov's improvements in GPU Gems.
Infinite Shadow Volumes
This sample implements the techniques described in the Practical and Robust Shadow Volumes paper.
Hardware Shadow Mapping
White Paper, 2005
Covers the details behind basic hardware shadow mapping with implementation details in OpenGL and Direct3D.
Shadow Considerations
White Paper, 2004
Strategic considerations when using shadows to achieve optimal performance and image quality.
GPU Gems 2 online:
Part II, Shading, Lighting and Shadows
Chapter 9. Deferred Shading in S.T.A.L.K.E.R.
Chapter 13. Implementing the mental images Phenomena Renderer on the GPU
GPU Gems online:
Part II, Lighting and Shadows
Chapter 9. Efficient Shadow Volume Rendering
Chapter 10. Cinematic Lighting
Chapter 11. Shadow Map Antialiasing
Chapter 12. Omnidirectional Shadow Mapping
Chapter 14. Perspective Shadow Maps: Care and Feeding
also available in PDF
Chapter 15. Managing Visibility for Per-Pixel Lighting
OpenGL Render to Depth Texture - 2004 Demo w/Source
This demo shows how to render to depth textures for shadow mapping in OpenGL through the WGL_ARB_render_texture and WGL_NV_render_depth_texture extensions.
CEDEC 2001: Shadow Mapping with Today's OpenGL Hardware
Presentation given by Mark Kilgard at CEDEC 2001 in Japan covers the use of shadow maps in OpenGL. Available as PDF in both English and Japanese.
How-To: CgFX/COLLADA Shared-Surface Shadowing
Description and Python tools for COLLADA Shared Surfaces, which can be used to develop scene-global shadows, reflections, and refractions in FX Composer 2.
GDC 2003: From Gaffer To Game Engine - Cinematic Effects
This presentation covers a wide range of creative shadow and lighting methods and uses, gleaned from the motion picture industry, television, and even Italian renaissance painting, with concrete real-time examples -- even GPU-driven interactive raytracing!

Soft Shadows

Samples from NVIDIA Graphics SDK 10.5:
Percentage Closer Soft Shadows (Whitepaper)
Percentage Closer Soft Shadows (PCSS) is a shadow mapping technique that renders realistic soft shadows with varying penumbra that harden on contact.
Variance Shadow Mapping (Whitepaper)
Variance Shadow Mapping was introduced in 2006 as a way to produce high quality soft shadows using arbitrary filter kernels. This allows for a sizable performance benefit over PCF as the shadow map can be pre-filtered with a separable blur.
Soft Shadows (Whitepaper)
This demo presents two algorithms for soft shadow rendering. The common advantage of the presented algorithms is that, in contrast with standard PCF (Percentage Closer Filtering) algorithms, they do not use pseudo-random samples to sample the shadow map. Hence, partially shadowed areas lack noise typically introduced by PCF algorithms.
Samples from NVIDIA Graphics SDK 9.52:
HLSL Soft Shadows (Whitepaper)
This sample shows how to use conditional branching to compute filtered soft shadows efficiently. This technique could also be applied to accelerate other filtering algorithms to increase performance significantly on GPUs that support Shader Model 3.0.
Simple Soft Shadows (Whitepaper)
This sample demonstrates how branching in fragment programs can be used to optimize soft shadow rendering in OpenGL. This technique could also be applied to accelerate other filtering algorithms to increase performance significantly on GPUs that support Shader Model 3.0.
GDC 2008: Soft Shadow Mapping
Part of a day-long collaboration of hardware and software vendors, this presentation covers a range of available soft shadowing techniques and explores details of their varying implementations and advantages.
Variance Shadow Maps
( PDF), 2006
Shadow maps are a widely used shadowing technique in real time graphics. One major drawback of their use is that they cannot be filtered in the same way as color textures, typically leading to severe aliasing. Variance Shadow Maps is an algorithm that approximates the occlusion, and solves the problem of shadow map aliasing with minimal additional storage and computation.
NVISION08: Beautiful Women of the Future
The last portion of this character-animation talk covers shadowing on characters and includes images from a survey on effective hair rendering techniques.
SIGGRAPH 2005: Exposing the SDK
Contains shadowing algorithms including a soft, "anime shadow" technique borrowed from Studio Ghibli.
Whitepaper: Integrating Realistic Soft Shadows into Your Game Engine
How to easily integrate an efficient method for creating realistic soft shadows on DirectX 10 and high-end DirectX 9 GPUs. Samples show our technique implemented in the recently (2008) released game Hellgate: London, developed by Flagship Studios
GPU Gems 2 online:
Chapter 17. Efficient Soft-Edged Shadows Using Pixel Shader Branching
GPU Gems online:
Chapter 13. Generating Soft Shadows Using Occlusion Interval Maps

Ambient Occlusion

To Trace or Not to Trace:
Image-Space Horizon-Based Ambient Occlusion

Louis Bavoil, Miguel Sainz, and Rouslan Dimitrov, NVIDIA Corporation
(Related Japanese Presentation)
Ambient occlusion is a lighting model that approximates the amount of light reaching a point on a diffuse surface based on its directly visible occluders. It provides a soft shadow appearance which enhances depth perception and spatial relationship between objects. In this talk, we present a new algorithm for rendering ambient occlusion as a post-processing pass by sampling a depth buffer and its associated normal buffer. We discuss how to integrate this approach in real-time engines as well as provide performance analysis.
Sample from NVIDIA Graphics SDK 10.5: Screen Space Ambient Occlusion (Whitepaper)
Ambient occlusion is a lighting model that approximates the amount of light reaching a point on a diffuse surface based on its directly visible occluders. We present a novel screen space ambient occlusion algorithm that gives perceptual clues of curvature and spatial proximity and thus is commonly used to add a global illumination look to rendered images. Our approach operates on the depth buffer of the scene being rendered and the associated per-pixel normal buffer.
Samples from NVIDIA Graphics SDK 9.52:
Dynamic Ambient Occlusion (Whitepaper)
This sample demonstrates a new technique for computing diffuse light transfer and shows how it can be used to compute global illumination for animated scenes. The technique efficiently calculates ambient occlusion and indirect lighting data on the fly for each rendered frame. It does not have the limitations of precomputed radiance transfer (PRT) or precomputed ambient occlusion techniques, which are limited to rigid objects that do not move relative to one another. It works by treating polygon meshes as a set of surface elements that can emit, transmit, or reflect light and that can shadow each other. This method is efficient because it works without calculating the visibility of one element to another. Instead, it uses a much simpler and faster technique that uses shadowing to account for occluding (blocking) geometry.
Ambient Occlusion using Hardware Shadow Maps
This example demonstrates hardware-accelerated "ambient occlusion" using a hemisphere of shadow-mapped lights. Each light is rendered in a separate pass, and the results are summed together using a floating point accumulation buffer. The projection matrix is randomly jittered to provide anti-aliasing.
GDC 2008: Real-Time Ambient Occlusion
This lecture does a review of multiple depth-buffer-based ambient occlusion techniques. Three of the described algorithms are ray-marching in the depth buffer, an algorithm based on accumulating solid angles, and a new hybrid method called "tangent tracing."
GPU Gems 2 online:
Chapter 14. Dynamic Ambient Occlusion and Indirect Lighting
GPU Gems online:
Chapter 17. Ambient Occlusion

Ray Tracing

Interactive Ray Tracing with CUDA
David Luebke and Steven Parker, NVIDIA Corporation
Ray tracing has long been associated with high-quality graphics, but it has not been suitable for interactive use. With CUDA and an NVIDIA GPU, it is now possible to ray trace reflections from curved surfaces, refractions, and accurate shadows. By combining these effects with rasterization to efficiently compute viewing ray intersections, accurate inter-reflections and other effects can be achieved at high resolutions and frame rates.

Want to Learn More? NVIDIA Documentation Home Page