Our assignment for this project was to add global lighting to our ray tracer by using a photon map. I was able to get the photon map integrated into my ray tracer, but it did not behave like I was expecting it to. I could never get the correct amount of light to be stored in the photon map unless I did some very odd scaling (other than 1/(number of photons)). Even when that worked, I had problems with the photons being very spotty, even with up to 10,000,000 photons in the scene.
Disappointed with my results, I sought out outside resources such as Henrik Wann Jensen's paper "Global Illumination using Photon Maps". These helped some, but they all referred to using BRDF's. I believe I understand the concept of BRDF's, but I am not sure how to integrate them into my current ray tracer, particularly in the short time I had to complete the project. I believe one more week would have helped tremendously, but unfortunately (um, I mean fortunately) the semester has come to an end. Anyways, the remainder of this page document my results.
The first series of images uses only the photon map for lighting. The results aren't that pretty, but they're kind of cool.
One of the first images that looked remotely correct:
Same as above, but using a different reflection angle for diffuse
inter-reflections:
I changing the method of deciding when to absorb light (I wasn't really sure
when to do this), but I forgot to multiply the light by the color of the object
it hit:
Same as above, but I added the multiplication. You can really see the
spottyness in this image. I can't remember how many photons there were (I think
around 10,000), but I was picking up photons within a radius of 0.5 at this
point:
Same as above, but with the number of photons bumped up to around
1,000,000:
Same thing, but using an area light:
Then I finally scaled down the photons and added in the light from the rest of
the methods (diffuse, specular, etc.). I also bumped the radius to look for
photons down to 0.1:
I added a clear ball. Here it is without photon mapping:
... and then with photon mapping:
Same as above, but with more photons:
I tried a point light instead of the area light to see if the results were
better, but they weren't. In fact, I can't explain some of the things in the
scene, like why the bright spots on the floor and ceiling are square shaped
instead of circular:
Same as above, but the ball is now reflective:
Overall, I'm happy I was able to get the photon map integrated into my ray tracer, but am disappointed I was not able to get any good looking results.
You can download the source code here. A sample scene is here.