Photon Mapping With Color Bleeding

by Cody Thompson

Description

A program that generates a photon map to render more realistic images than ray tracing and is faster than Monte Carlo Ray Tracing. (written in C++ using the Eigen library)

Features

Notes:

General Algorithm:

First Pass: Photon Map

  1. For each light, push n photons with intensity 1 out from it in random directions.
  2. Trace photon until it collides with an object.
  3. Randomly find whether or not the photon is reflected or absorbed.(Normally here you would use Russian Roulette, however I misinterpretted Jensen's explanation and as such did it like this. Russian Roulette is described correctly below).
  4. Build KDTree (similar to Jensen's implementation) to store the photons.

Second Pass: Rendering

  1. Trace rays from camera to scene with respect to the look at point.
  2. Set sample square dist (ssd).
  3. Find point where ray intersects nearest object.
  4. Use Jensen's photon locator KDTree traversing algorithm.
  5. Average the intensities of all the photons multiplied by the BRDF calculation, brightening the non shadow photons during which.
  6. Divide the average by the area of the sampling sphere.
  7. Calculate phong shading of vertex, and add the calculated intesity.

Actual Russian Roulette:

  1. Calculate probability to do a diffuse reflect Pd.
  2. Calculate probability to do a specular reflect Ps.
  3. Randomly select number from 0 to 1.
  4. If number is less than Pd, do a diffuse reflection.
  5. If number is less than Pd plus Ps, do a specular reflection.
  6. Otherwise, just absorb the photon.

Pictures

These pictures are all my progress reports with the photon map.

Initial ray tracing version.

Original ray trace versions of my scenes.

Photon Map.

Using 20,000 photons, and ray tracing with each acting as a sphere.
Light is directly above the sphere from now on.

KDTree Build and Traversing.

Form the ktree and traverse to find direct illumination photons (green) and indirect photons (red).
Color vertices according to DI photons.
Color vertices according to both types of photons.
Adjust sampling to get around 1000 photons, ssd of 0.5, and 100000 photon emmittance.

Shadow Photons.

No shadow photons on left, exist on right.
Notice the increased shade below sphere and on bottom half of sphere.

Scaling.

Left image is with emmitting 1 million photons, having overall 3.2 million, sampling for 10,000 photons, ssd of 0.5.
Right image is with emmitting 3 million photons, having overall 7.3 million, sampling for 10,000 photons, ssd of 0.5.
The latter takes approximately 20 seconds to render.

BRDF Calculations.

Initial changes in intensities with the BRDF calculations and slight modifications in the sampling.

Finished.

Final results
Sampling with 300,000 photons, for 10,000 photons with an ssd of 1.0.
Rendering takes about a minute.

Sources

Bugs / Unfinished Areas of this Project