In this project we will replace path tracing for indirect illumination with photon mapping.
Implement photon mapping.
Render a scene using only photon mapping for illumination (direct and indirect).
Render a scene using photon mapping for indirect illumination only.
Make sure that point lights have inverse square fall-off.
The following source code files are provided to help you with this and upcoming projects. You are not required to use them, but it is highly recommened that you use them and refrain from modifying them. Some of these files include additional code as compared to the same files in the previous project, so make sure to download them all again.
cyPhotonMap.h: Photon Map Implementation you can use for storing photons and estimating irradiance from the photon map.
scene.h: Includes the photon map extensions for the Light and Material classes.
viewport.cpp: OpenGL based preview and user interface launched by calling the ShowViewport() function. It requires GLUT or FreeGLUT. This version has additional code in the PointLight::SetViewportLight() method that supports inverse square fall-off.
PhotonMapViz.cpp: Photon map visualization tool. Compile this tool separately. It loads the photon data from a file and displays it as 3D points. You will need to save your photon data to a file before you can use this tool. You can save the photon map to a file using the following code block.
You may want to scale your photon colors before you save, so that they are not too dark.
The following scene files are provided to help you test your implementation. You can also prepare other scenes to show your work.
Cornell Box: A Cornell box scene with a Utah teapot and two spheres.
Optional Feature Suggestions
Add a Monte Carlo sampling bounce for indirect illumination.
Implement precomputed irradiances to achieve higher performance.
Implement final gathering using importance sampling based on the photon map information.
Irradiance mapping for final gathering.
Henrik Wann Jensen. 1996. Global illumination using photon maps. In Proceedings of the eurographics workshop on Rendering techniques '96, Xavier Pueyo and Peter Schröder (Eds.). Springer-Verlag, London, UK, UK, 21-30.
Henrik Wann Jensen. 2004. A practical guide to global illumination using ray tracing and photon mapping. In ACM SIGGRAPH 2004 Course Notes (SIGGRAPH '04).