Photon Mapper
CIS561: Advanced Rendering — Spring 2020
C++
Overview
As a part of my core curriculum for my Computer Graphics (Digital Media Design) major, I took an Advanced Rendering course. This course intended to provide knowledge of computer graphics techniques in 3D modeling, image synthesis, and rendering. The topics covered include geometric transformations, algorithms, 3D object models (surface, volume, implicit), shading, mapping, ray tracing, global illumination, sampling, anti-aliasing, Monte Carlo path tracing, and photon mapping. This project is the final project I completed in that course in which I implemented a photon mapper to create renders.
Process
For photon mapping, this rendering model calculates the rendering equation through a two pass global illumination algorithm.
First, for each light source, n photons are emitted and traced around the scene until it collides into an object, such as a sphere or a cube. A “Russian Roulette” method is used to calculate whether or not the photon is absorbed or reflected. The photons are then stored in a photon map. The data structure used to store the photons is a kd tree which is a binary tree which is used to represent points in a k-dimensional space.
After that, the next step is to render. Rays from the camera are traced to the scene, and we identify points where the ray intersects the closest geometry. The photon map is used to find photons within a given radius from the object, and the photons in the sampling sphere are stored. Their intensities are added to calculate the indirect and caustic effect of the photons, and are then divided by the area of the sampled sphere. All these calculations contribute to the rendering of the scene.
Results
Here are renders that I created with the photon mapper.

Details: 100 samples per pixel
Recursion depth: 5
400x400 pixels
Render time: <15 min
Number of photons: 100k
Radius: 0.3

This shows indirect and caustic mapping.
Details: 100 samples per pixel
Recursion depth: 5
400x400 pixels
Render time: <15 min
Number of photons: 100k
Radius: 0.3

Title: Queen
Details: 100 samples per pixel
Recursion depth: 5
400x400 pixels
Render time: 1.5 hrs
Number of photons: 100k
Radius: 0.3

Title: An Experiment in Texturing
Details: 100 samples per pixel
Recursion depth: 7
550x550 pixels
Render time: 1.5 hrs
Number of photons: 100k
Radius: 0.3
Textures from 3DTextures website

Title: Bleeding Spheres
225 samples per pixel
Recursion depth: 5
550x550 pixels
Render time: 2 hrs
Number of photons: 100k
Radius: 0.3