Dynamic Stratification

The Main Idea
Ray tracing is all about creating, evaluating, and combining samples of functions to estimate their integrals over some domain. One particularly important job is evaluating the light arriving at a point (which we call the shading point), in order to determine how much light leaves that point; this is the process of shading.

Dynamic stratification is a method for increasing the utility of these illumination samples by increasing their accuracy. This is done by first sampling the light coming into a shading point and estimating the energy coming in along each ray. When all the rays have been fired, we re-evaluate the energy carried by each one based on the final distribution of rays in the environment.


Besides making the ray samples more accurate, this also allows us to leave behind the awkward and ambiguous distinction between "shadow", "reflection", and "transparency" rays, and the book-keeping required to tell them apart.

Results
The technique of dynamic stratification has been implemented in the Spectrum image synthesis testbed; you can see a couple of sample pictures made with the technique on the Spectrum page.
Details

To see the problem that's addressed, consider the typical process of evaluating incident light. We begin by shooting a number of "shadow rays" to the light sources. If a given ray strikes some other object before hitting the light source, it is ignored; that's a shame, because that means we're throwing away some useful information - after all, there is always the possibility that some light is traveling down this ray towards the shading point. After the shadow rays are cast, we cast reflection and transmission rays. We have to do some book-keeping here, though, because if one of these rays strikes a light source, we have to throw it out because we don't want to count the light twice. Once again, we're throwing away useful information.

Finally, consider the problem of figuring out just what light is arriving along these samples. Suppose 7 different rays strike a particular light source; just how much light is carried along each ray? The answer depends on the specific visual region represented by each sample on the surface of the light, but we don't know that region until all the rays have been generated. Typically, we evaluate samples as we go (to help with adaptive sampling schemes), so generally one never goes back and re-evaluates samples based on the new sampling pattern.

To summarize, the traditional approach wastes some information, and doesn't bother getting other parts right.

The method of dynamic stratification says that all rays are the same - there is no distinction between "shadow", "reflection", "transmission", and other types of rays. One simply shoots out lots of rays, and makes a rough guess at how much energy is carried back along each ray as the sampling process proceeds. Adaptive sampling can fire more rays in regions that seem to need it, using whatever criteria one likes. When all the rays are in, we make a list of all the objects that contribute light to the shading point (both light sources and passive objects). Then we scan the list of objects, and for each one we find all the samples on the surface, and figure out how much of the surface is represented by each sample. Now we figure out a new estimate for each sample based on this region. For example, rays may hit a flourescent light fixture with a couple of bright bulbs in it; some rays may strike the bright spots under the bulbs and some may just strike the diffusing panel. The rays striking near the bulb carry back more energy.

The technique is made more useful by looking also at rays that could have hit each object, but didn't, because they were blocked. Basically for each object, we find every ray that could have hit the surface (if nothing was in the way), and we find the point(s) where the ray would have hit. We know the regions represented by those points are invisible, which helps us make tighter regions around valid hits, and also correctly account for silhouettes.

More Info

You can read about this technique in my paper on the subject; the citation is below. The method has been incorporated into the Spectrum image rendering architecture as an option. You can also read about it in Chapter 19 of my book "Principles of Digital Image Synthesis".

Glassner, Andrew S., "Dynamic Stratification," Proc. 4th Eurographics Workshop on Rendering, Michael Cohen, Claude Puech, and Francois Sillion, Ed., Paris, June 1993, pp. 5-14

Glassner, Andrew S., "Principles of Digital Image Synthesis", Morgan-Kaufmann Publishers, San Francisco, 1994.