HOME    CLASSES    JAPANESE    CONTACT    MY PROFILE   

Program Five: Photon Mapping

For this assignment, I was to implement Henrik Wann Jensen's photon mapping. The basic idea is this: Make two passes, in the first pass, create the photon map. You do this by shooting photons from each light source and store them where they land, generally speaking. After you have the photon map, your second pass will be a normal ray trace, however your light for each pixel is additionally based off of the "region" of photons at each point, where a region is a sphere whose center is at your current intersection or hit point.

What photon mapping adds to the scene is diffuse interreflections and caustics. Diffuse interreflections are reflections that bounce off of diffuse surfaces based on the BRDF of the surface material. For my implementation, I simply choose a new direction at random. Caustics are areas of concentrated light. For example, the reflection of light off of the surface of water is a caustic. The global illumination that photon mapping gives us makes the images look much more realistic.

One of my first problems was, when using Jensen's algorithm to store into and balance the kd-tree (the data structure used for photon mapping, it is what makes photon mapping much more efficient), i was mixing doubles and floats, which gave me random seg faults. The only problem left outstanding is my diffuse interreflections. For some reason it does not collect much light, no matter how many photons I shoot.

Now, here are some images:
Final image:

This image was anti-aliased, but as you can see, there are still aliasing issues. I'm not sure yet if those are color-bleeding effects or not. I am using a slightly older implementation of my ray tracer.


Errors:

These are some of the many errors that I had.


















Brian Caines © 2024 BrianCaines.com