next up previous contents
Next: 12. Transparency Up: 11.4 Creating Shadows Previous: 11.4.4 Soft Shadows by

11.4.5 Soft Shadows Using Textures

Heckbert and Herf describe an alternative technique for rendering soft shadows by creating a texture for each partially shadowed polygon in the scene [47]. This texture represents the effect of the scene's lights on the polygon.

For each shadowed polygon, an image is rendered which represents the contribution of each light source for each shadowed polygon, and that image is used as a texture in the final scene containing the shadowed polygon. Shadowing polygons are projected onto the shadowed polygon from the direction of the sample point on the light source. The accumulation buffer is used to average the results of that projection for several points (typically 16) on the polygon representing the light source.

The algorithm finds a single quadrilateral that tightly bounds the shadowed polygon in the plane of that polygon. The quad and the sample point on the light source are used to create a viewing frustum that projects intervening polygons onto the shadowed polygon. Multiple shadow textures per polygon are avoided because each ``lighting'' frustum shares the base quadrilateral, and so the shadowing results can all be accumulated into the same texture.

A pass is made for each sample point on each light source. The color buffer is cleared to the color of the light, and then the projected polygons are drawn with the ambient color of the scene. The resulting image is then added into the accumulation buffer. The final accumulation buffer result is copied into texture memory and is applied during the final scene as the polygon's texture.

Care must be taken to choose an image resolution for the shadow texture that looks acceptable on the final polygon. Depth testing and texturing can be disabled to improve performance during the projection pass. It may be necessary to save the accumulation buffer at intervals and average the results if the contribution of a shadow pass exceeds the resolution of the accumulation buffer.

A paper describing this technique in detail and other information on shadow generation algorithms is available at Heckbert and Herf's web site [48].

The Heckbert and Herf method of soft shadow generation is essentially the superposition of numerous ``hard'' shadows. The contributions from individual shadowing polygons are usually noticeable unless an extremely large number of shadowing polygons are used.

Soler and Sillion [91] model the special case of a light source, shadow occluder, and shadow receiver, all in parallel planes, with a convolution operation that results in shadow textures with fewer sampling-related artifacts. First, the light source and shadow occluder are represented as images. Scaled versions of the images are then efficiently convolved through the application of the Fast Fourier Transform (FFT) and its inverse to produce a soft shadow texture. Soler and Sillion go on to apply approximations that generalize the ``exact'' special case of parallel objects to more general situations. While the FFT at the heart of the technique is not readily accelerated by OpenGL, the technique is still very useful because of its speed for pre-computing high-quality shadow textures that can later be used as light map textures during OpenGL rendering.


next up previous contents
Next: 12. Transparency Up: 11.4 Creating Shadows Previous: 11.4.4 Soft Shadows by
David Blythe
1999-08-06