comp870 - Assignment 3

Overview

For this assignment, I have implemented a photon mapper, complete with final gathering sampling and caustic effects. As with most photon mapping implementations, I have added a kd-tree stucture to store the photons in. The tree is split olong the largest spatial axis when performing subdivision. During photon retrevial, photons can be matched within a specific distance of the serach location, or a certain number of close photons. Instead of matching closest photons in a heap, I start with a small search distance and expand until the desired number of photons have been found, similar to suggestions in [2]. In constructing the output image, the final pixel value is estimated from the direct contribution from the light, the indirect scattering effect from nearby surfaces, and the contribution from caustic materials.

The code and data for the project is available here.

Process

Photon tracing
Photons are emitted from the light source and propagated through the scene. As the photons encounter diffuse geometry, they are stored in the photon map. Photons may also be transmitted by specular surfaces. Photons are transmitted based on russion roulette, as described in [1].

image
Image of the photons after propagation.

Direct visualization
At this point, the photon map may be visualized directly by tracing primary rays from the camera into the scene. At each intersction point, the nearby photons may be gathered into a radiance estimation. Note that direct visualiztion often results in artifacts without careful gathering. It also relies on a large number of photons to be traced or gathered to prevent uneven color distribution.

image
Direct visualization of the photon map.

image
Density of the photon map, with 90,000 photons traced.

Caustic map
If caustic effects are being rendered, a seperate photon map may be used to store the caustic photons. These can then be directly visualized in the final rendering step. Many photons must be stored in the caustic map to allow a high quality rendering.

image
The caustic map, enhanced for visualization.

Results

I rendered variations of the Cornell box scene to demonstrate my photon mapper. The first is the classic box layout. The second replaces the boxes with objects with specular materials. The final output is a combination of indirect illumination by diffuse sampling of the scene, direct illumination by typical raytracing methods, and direct visualization of the caustic photon map. For the images below, 90,000 photons were traced. In the gathering stage, 200 diffuse rays were cast, with the maximum sphere gather distance at about 10% the length of a wall. The reported times are from running on a 2Ghz CPU.

image
The Cornell box. 28 minutes.

image
A scene with caustics. 31 minutes.

References

Jensen, Global Illumination using Photon Maps, Proceedings of the eurographics workshop on Rendering techniques '96, 1996, 21-30
Jarosz, Advanced Global Illumination using Photon Mapping, ACM SIGGRAPH 2008 classes, 2008, 1-112