Photon mapping – first steps

12 Apr 2010

Recently I started integrating GPU based photon mapping into my application. I managed to implement the basics directly on the GPU:

  • kd-tree implementation for point-storage (photons)
  • Photon map construction using photon tracing
  • KNN search using kd-tree implementation (to gather photons)
  • Final gathering to avoid blurriness of result

Right now I use just one photon map for indirect illumination as I only work with Lambertian reflection for now. This shouldn’t be a problem for the Sponza scene (no specular reflection).

My current algorithm just performs final gathering for all shading points. Therefore it is quite slow. The next image shows the Sponza scene rendered using my application MNRT:

Sponza scene (photon mapping)

I picked these parameters:

  • 10 bounces for photon tracing (no Russian roulette yet)
  • About 80000 photons in the photon map for indirect illumination
  • 200 final gather samples
  • 2×2 super sampling, 512×512 image resolution

Note the noise in indirectly illuminated regions. According to my tests, this can be improved by using more final gather samples. My RNG (random number generator) shouldn’t be the problem as I use the Mersenne Twister RNG from the CUDA SDK. However there might be some error in my code.

The large numbers of final gather rays and shading points led to a render time of about 10 minutes for a single image. Next I want to improve this by selecting a small number of irradiance sample points as proposed by Wang et. al.