Using Photon Mapping to Generate Caustics


Ray Tracing verses Photon Mapping


The Whitted ray tracing model we learned in class is ideally suited for rendering glossy surfaces, transparent objects, textured surfaces, and clean shadows. However, at least two important lighting effects are not easily simulated using ray tracing. These include global illumination, and generation of caustics. Both of these effects, however, are ideally suited for technique known as photon mapping.

For one aspect of our project ,we chose to implement a photon map to generate caustics. We relied on the implementation described by Henrik Wann Jensen, in his book Relaistic Image Synthesis Using Photon Mapping. The subject matter we chose to model was caustics formed on the bottom of a pond. Below, we describe the method, and the challenges presented in implementing photon mapping.


How are caustics generated?

Caustics are generated when beams of light are focussed on a particular point in space. One common example of a caustic is are the avy lines generated at the bottom of a swimming pool, such as


Caustics generated at the bottom of swimming pool. (Courtesy of a public repository for texture maps

Another common example is the bright spot of light that forms when the sun hits a piece of glass, such as a magnifying glass


Caustics formed by light being focussed by glass ball. (Courtesy of Henrik Wann Jensen's webpage).

Another example of a caustic is the result of light focussing due to specular bounces off of a shiny material such as metal. Here is another example from Jensen's webpage :


Caustics formed by light being specularly reflected off of a metal ring. (Courtesy of Henrik Wann Jensen's webpage).
The reason that ray tracers are not well suited for generating caustics is that when an incoming ray from the viewport lands on the spot where a caustic should be generated, a second ray is spawned in only one of two directions - the direction determined by the specularity of the surface, and the direction towards the light. However, the reason that the caustic is so much brighter than surrounding areas on the surface is that several light rays were focussed there. A ray which lands on this spot would somehow have to reverse this focussing phenomenon and guess a direction, not necessarily directly toward a light source, that will be focussed at the light source. This process generally not well-conditioned, since an infinite number of light rays are focussed on the single caustic spot. Monte Carlo techniques are also not going to solve this problem, since not enough rays in general will ever land on the surface where a caustic should be created.

The idea behind photon mapping


Photon mapping avoids this need to re-trace the steps of a focussed light beam and instead emits photons from a given light source and follows them until they land on diffuse surface, where they are stored. Photons are tiny packets of "light" energy, which will naturally focus when sent through media which transmits or reflects light. A data structure called a "photon map" is then constructed which is later, as part of the rendering step, queried to get irradiance values at a given surface location.

Implementation of Photon tracing

To render caustics, we used a two-pass strategy. In the first pass, we emit photons from light sources, and follow them until they land on a diffuse surface, where they are stored. Second, we render the scene, using the photon map to compute the irradiance at a particular surface location. In our case, we only wanted to generate caustics, so we only store photons on a diffuse surface if they have had at least one specular bounce. The trace the photons, we created a PhotonTracer class, which is very similar to the RayTracer class. We also created a new window in which to visualize the photonmap.


Our results

Below, is a picture of a photon map, and the results of rendering using this map. Since we only generated a caustics map, we only stored photons on diffuse surfaces. Hence no photons were stored on the glass sphere.


Photon map (left) and rendering of caustics (right).


Last modified: Fri Mar 19 17:38:15 PST 2004