Next: 11.2.1.6 Other Sphere Mapping Up: 11.2.1 Sphere Mapping Previous: 11.2.1.4 Warping a Sphere

#### 11.2.1.5 Multipass Techniques and Interreflections

Scenes containing two reflective objects may be rendered using sphere maps created via a multipass algorithm. Begin by creating an initial sphere map for each of the reflective objects in the scene. Choice of initial values was discussed in detail in Section 11.1.5. Then iterate over the objects, recreating the sphere maps with the current sphere maps of the other objects applied. The following pseudocode illustrates how this algorithm might be implemented:

```do {
for (each reflective object obj with center c) {
initialize the viewpoint to look along the axis (0, 0, -1)
translate the viewpoint to c
render the view of the scene (except for obj)
save rendered image as cube1
rotate the viewer to look along (0, 0, 1)
render the view of the scene
save rendered image as cube2
rotate the viewer to look along (0, -1, 0)
render the view of the scene
save rendered image as cube3
rotate the viewer to look along (0, 1, 0)
render the view of the scene
save rendered image as cube4
rotate the viewer to look along (-1, 0, 0)
render the view of the scene
save rendered image as cube5
rotate the viewer to look along (1, 0, 0)
render the view of the scene
save rendered image as cube6
using the cube images, update the sphere map of obj
}
} while (sphere map has not converged)
```
Note that during the rendering of the scene, other reflective objects must have their most recent sphere maps applied. Detection of convergence can be tricky. The simplest technique is to iterate a certain number of times and assume the results will be good. More sophisticated approaches can look at the change in the sphere maps for a given pass, or compute the maximum possible change given the projected area of the reflective objects.

David Blythe
1999-08-06