In this project we will replace path tracing for indirect illumination with photon mapping.
Requirements
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.
Source Code
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 some of 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.
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 may want to scale your photon colors before you save, so that they are not too dark.
scene.h: Includes the photon map extensions for the Light and Material classes as well as changes for supporting multi-materials. The hit information now keeps material ID, which needs to be updated whenever a hit is found.
materials.h: Includes the the photon map extensions and multi-material.
viewport.cpp: OpenGL based preview and user interface launched by calling the ShowViewport() function based on the GLUT library (the Windows version is here). This version has additional code in the PointLight::SetViewportLight() method that supports inverse square fall-off. I is also updated for supporting triangular meshes with multi-materials.
objects.h: Includes changes for supporting multi-materials.
xmlload.cpp: Includes changes for supporting multi-materials.
Test Scenes
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 (you can use the cyIrradianceMap.h source code).
References
[Jensen 1996]
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.
[Jensen 2004]
Henrik Wann Jensen. 2004. A practical guide to global illumination using ray tracing and photon mapping. In ACM SIGGRAPH 2004 Course Notes (SIGGRAPH '04).