Description
An ill-fated attempt to implement photon mapping. The full implementation stores two photon maps. The first-pass map is used for lighting calculations in my path tracing algorithm. The second pass is concentrated towards specular objects noted in the first pass and is integrated into the direct lighting algorithm.
Unfortunately, my implementation so far is rather inefficient, slow, and prone to mysterious crashes. The images below were rendered with a middle-ground implementation which uses path tracing alone for indirect lighting and uses the second-pass photon map (without shadow rays) for direct lighting. This has the effect of producing interesting caustics in a reasonable amount of time (and with far fewer crashes).
I intend to code a more effecient implementation this summer and, eventually, to get some interesting images up. Until then, here's what I've managed.
The Scene
![]() |
![]() |
|
These were rendered with very few (four) samples per pixel due to the speed and memory problems of my current implementation. I disabled shadow rays because they tended to mute the interesting detail given by photon mapping. It should be pointed out that the glass sphere is not a perfect sphere, but tesselated, and with rather large polygons. Again, this simply gives more interesting detail.
In the first image, the large luminaire produces speckes on the wall and floor. These are caused by the occasional indirect lighting ray getting lucky and hitting the luminaire directly. However, photon mapping works well for small luminaires, so in the next two images we shrink the light to only a few pixels, and then until it doesn't even show up. The speckles disappear because no rays are lucky enough to hit the luminaire. For reasons I'm not entirely clear on, this also produces some interesting lighting effect along the wall which don't show up with a larger luminaire.
Path Tracing Comparison

Ok, this scene is identical to the first scene above, but is rendered with more samples per pixel. Direct lighting is still not used, in order to give an accurate comparison. A small bright spot appears underneath the sphere, but we get none of the truly interesting features that we see above.