Project - Progressive Photon Mapping Implementation

Ahmet Alperen Akcay and I chose implementing Progressive Photon Mapping for extending our ray tracers. However, since the flow of the algorithm is different and not suitable for adding to our raytracers' interfaces, we took only needed parts of my ray tracer and implemented it as a different project.

Introduction


Global illlumination is one of the core issues for computer graphics. There are several algorithms developed for simulating lighting of the scenes correctly and efficiently to solve the rendering equation (Kajiya, 1986).

Proposed by Hachisuka and Jensen (2008), Progressive Photon Mapping is one of those algorithms developed through years. It can simulate illumination of caustic objects and Specular-Diffuse-Specular paths better and faster than other techniques. Yet, getting desired image quality still takes time.



Related Work


In the original Photon Mapping algorithm developed by Jensen (1996), there exists two different steps. In the first step, a photon map is constructed from the light-surface interactions by sending photons from each light source. Photon map holds the information about illumination contribution of the individual photons. In the second step, rays are sent from the camera to render by using radiance calculated from photon map. These calculations are done by locating nearest photons to the hit point. To improve final quality of the image, number of photons needs to be increased which will also increase the size of the photon map.

To improve performance of the algorithm, Reverse Photon Mapping is introduced by Havran et al. (2005). This approach reverses the steps of the photon mapping by using ray tracing for the first step and photon tracing for the second. Ray tracing step builds a tree structure of hit points and photon tracing step uses this step to find contributions of photons to nearest hit points.


However, photon mapping has some restrictions in memory. More photons are needed for better accuracy, but increasing sizes of the photon map in the memory. Due to this issue, details are not fully captured. Progressive Photon Mapping addresses this issue by providing a new way to compute contributions of photons progressively without holding huge photon maps. PPM uses multiple photon tracing steps and accumulate the result with each iteration. Since it is not bounded by memory, more accurate solutions can be observed.


In the PPM, order of the steps is reversed same as reverse photon mapping. Eye tracing step is the first step. In the eye tracing step hit points of the rays are recorded to be used in further steps. Next step is iterative photon tracing step. This part is the progressive part of the algorithm. On each iteration, photons are sent to scene and the contribution of each photon added to hit points generated in the eye tracing step. After photon tracing step, scene is rendered using accumulated radiance information on the hit points.

Hachisuka and Jensen (2010) provided also a method for being able to parallelize progressive photon mapping algorithm. Normally, PPM uses spatial hashing to hash hit points and use constructed hash grid while tracing photons to calculate radiance contribution of the photons. However, spatial hashing is not suitable for parallelization. They proposed stochastic hashing method to address this issue. In stochastic hashing, each hash entry of the photon map holds only one photon instead of list of photons. Photons are selected with uniform probability and flux of the stored photon divided by this probability to keep results consistent. 


Further Reading: http://www.ci.i.u-tokyo.ac.jp/~hachisuka/ppm.pdf


Outputs
For rendering, we adapted two scenes:


  • Cornellbox scene for path tracing of Homework 7. While adapting this scene, increasing recursion depth caused transparent sphere attenuate a lot. Also sphere's transparency is lower than the original scene, and wall materials are different a little.
  • Different Cornellbox scene with a water surface. While we were doing research for the project, we found a cornellbox scene with water surface model on the website of EDAN30 Photorealistic Computer Graphics (discontinued) course of Lund University. Thanks to Emre Baris Coskun for helping us convert the model data to our format, and thanks to Necip Fazil Yildiran for giving idea of rendering same scene from another angle. After converting the water surface model, we adapted the scene to our format.
  • exr outputs: https://drive.google.com/drive/folders/197DmW0sU4ZwWIDwJXRrY1GOWF3w3-MaC?usp=sharing
Notes:
  • Increasing sample size increases memory need of the eye pass a lot. We tried only 16 spp for great number of photons. Other renderings are done with 1spp. Rendering different images with different samples and averaging them with sample weights may help, but it would increase rendering time.
  • While rendering scenes with different parameters, we overwrited some exr outputs. But all png outputs are complete.
  • While rendering water scene from top, we needed to do some hacking. We hardcoded refractive index of air for glass material as refractive index of water, since we couldn't find an elegant way to handle different refractive transmissions.
  • Unfortunately, we didn't have time to implement different lights for the ppm.
  • Also we will try to render Torus and Box scenes from Hachisuka's article. I will update the blog post after we get satisfying results.
  • When the total number of photons is small, outputs are kind of funny :)
  • Only significant rendering times are shared, all of them were rendered on my Windows desktop build.
  • Personally, if I continued my graduate education on METU and there was a course called Advanced Ray Tracing II (or any applied advanced graphics course) offered by Associate Professor Ahmet Oguz Akyuz, I would definitely want to take it. Thanks again to Mr. Akyuz for accepting us as undergraduate students to his course. I suggest to everyone who are interested in Computer Graphics taking this course. It was a fantastic experience.
cornellbox_ppm.png(1spp-10K photons)
cornellbox_ppm.png(1spp-100K photons)
cornellbox_ppm.png(1spp-1M photons)
cornellbox_ppm.png(1spp-40M photons)
cornellbox_water_flatshading.png(1spp, 25M Photons, both spheres are mirrors, next examples are smooth shading )
cornellbox_water.png(1spp-10K photons)
cornellbox_water.png(1spp-100K photons)
cornellbox_water.png(1spp-1M photons)


cornellbox_water.png(1spp-25M photons)
cornellbox_water.png(1spp-100M photons)

cornellbox_water.png(16spp-100M photons-rendered in 25 minutes)
cornellbox_water_top.png(1spp-10K Photons, darker due to tonemapping since caustics are bright)
cornellbox_water_top.png(1spp-100K Photons)
cornellbox_water_top.png(1spp-1M Photons)
cornellbox_water_top.png(16spp-100M Photons-rendered in 1 hour and 20 minutes)

REFERENCES
[1] HACHISUKA,T.,OGAKI,S.,ANDJENSEN,H.W.2008.Progressive photon mapping. ACM Transactions on Graphics (SIGGRAPH Asia Proceedings) 27, 5, Article 130.
[2] HACHISUKA, T., AND JENSEN, H. W. 2010. Parallel progressive photon mapping on GPUs. SIGGRAPH Asia 2010 Technical Sketches. 
[3] HAVRAN, V., HERZOG, R., AND SEIDEL, H.-P. 2005. Fast final gathering via reverse photon mapping. Computer Graphics Forum
(Proceedings of Eurographics 2005) 24, 3 (September).
[4] JENSEN,H.W.2001.
RealisticImageSynthesisUsingPhotonMapping.

A. K. Peters, Ltd., Natick, MA
[5] KAJIYA, J. T. 1986.
The rendering equation. Computer Graphics

(SIGGRAPH Proceedings) 20, 4, 143150. 

Yorumlar

Bu blogdaki popüler yayınlar

Homework 3 - Transformations, Instancing, Distribution Ray Tracing

Homework 7 - Object Lights, Spherical Environment Mapping, Path Tracing

Homework 4 - All About Textures (Textures, Perlin Texture, Bump Mapping)