next up previous contents
Next: 11.1.5.2 Blurry Reflection Up: 11.1.5 Further Realism Previous: 11.1.5 Further Realism   Contents


11.1.5.1 Interreflections

Either the stencil technique or the texture mapping technique may be used to model scenes with interreflections. Each algorithm uses additional passes for each ``bounce'' that the light takes. The application will need to determine the maximum number of interreflections to be rendered.

When using the stencil technique, it is necessary to rearrange the stencil operations so that the reflected scene images are masked directly by the stencil buffer. Render the reflections with the deepest recursion first. Concatenate the reflection transformations for each reflection polygon involved in an interreflection. Render each reflected image as follows:

21.
Clear the stencil buffer.
22.
Set the stencil operation to increment stencil values where pixels are rendered.
23.
Render each reflector involved in the interreflection into the stencil buffer.
24.
Set the stencil test to pass where the stencil value equals the number of reflections.
25.
Apply planar reflection transformation overall, or apply curved reflection transformation per-vertex
26.
Draw the reflected scene
27.
Draw the reflector, blending as desired.

The choice of the initial color applied to reflectors in the scene can have an effect on the number of passes required. The initial reflection value will generally appear as a smaller part of the picture on each of the passes. A good initial guess is to set the initial color to the average color of the scene.

When using the texture technique, render with the deepest reflections first as above. The texture algorithm is more simple in that the only operations for each reflection are to apply the concatenated reflection transformations, copy the image to texture memory, and apply that image to the reflector during the next pass.

In an interactive application with moving objects or a moving viewpoint, it may be acceptable to use the reflection texture with the contents from the previous frame. This use of previous results is one of the advantages of the texture mapping technique.


next up previous contents
Next: 11.1.5.2 Blurry Reflection Up: 11.1.5 Further Realism Previous: 11.1.5 Further Realism   Contents
2001-01-10