During the weekend I implemented a progressive photon mapper for the rendering course I am currently taking. It was really fun to finally implement a progressive photon mapper — it’s something I have been wanting to do for quite a while.
The idea of photon mapping is to trace photons from the light sources in the scene and then gather the radiance for points visible from the camera. This is a two-pass technique, as opposed to the one-pass path tracing technique where rays are only traced from the camera.
Photon mapping performs much better for rendering caustics than path tracing does. I rendered the image below to demonstrate caustics generated from a point light source shining through a water surface. The bright spots on the bottom of the pool are caused by the waves focusing photons from the light source:
The caustics seen in the image above would not have been possible to generate correctly using path tracing since they are from a point light. The scene could be lit with a very small area light to approximate the same effect. However, a small area light source in general performs extremely poorly in path tracing.
Path tracing is still a very nice technique because it is so simple to implement and simple to parallelize. Photon mapping does seem a bit trickier to parallelize in a smart way. It would probably be inefficient to let parallel threads render into the same photon map. Instead, one could have separate photon maps for each thread and merge the results into a final output image. I look forward to experimenting with this a bit.