Global Illumination
Zack Waters

Independent Study
Prof. Emmanuel Agu
Worcestor Polytechnic Institute

Abstract

For my independent study I am studying global illumination algorithms with an emphasis on GI in participating media.  I have been working on a raytracer called StingRay which already supports photon mapping.  The photon mapping implementation in StingRay currently supports speedups such as pre-computed irradiance, irradiance gradients and caching.  I would like to extend this implementation to incorporate participating media.

Below is a high level overview of the work that I have done so far.  I also provide a list of deliverables for the project.

 

Where does the light come from?

To create realistic looking scenes the lighting is everything.  The initial implementation of StingRay supported point and uniform area light sources.  However, in recent years high dynamic range environments have become all the rage.  These serve as great sources of light and in addition it would nice to generate photons used in the entire scene from these light sources.  I decided to focus on this so that I can achieve more realistic lighting effects when rendering surfaces and participating media.
 
HDR Light Probes
 
I added support for Paul Debevec's HDR light probes.  My implementation reads in the HDR light probe, represented using Ward's RGBE format, and converts it to a floating point longitude/latitude map.  The longitude/latitude representation serves as my internal format for all environment maps that StingRay reads in.

The scene below strictly just reflects the environment map using standard environment map techniques.  The shadows were treated separately.  Lately there has been some buzz on a technique called Ambient Occlusion.  This is what I am using below for the shadows.  Basically, the idea is that you have an all white light probe and then sample it.  During this process you test for occlusion and generate the shadow maps.  The shadow maps can later be combined with other passes of the rendering.  This is basically a speed up algorithm but for our simple scene it doesn't speed up much.  It just gives us cool shadows.

 

StingRay rendering using RNL light probe. StingRay rendering using Uffizi light probe.
 
These images are using light probes from Paul Debevec's website.  Soon I hope to generate my own light probes using a new SLR Nikon digital camera.  I just need to purchase the mirrored ball which Paul Debevec points out several places to purchase them from.
 
Structured Importance Sampling
 

The renders above are using outdoor light probes that have large area light sources.  If we were to sample it for the diffuse components of the scene it would not be that noisy.  However, for other light probes containing smaller area light sources the images produced are very noisy.  The image below is sampling the Grace Cathedral environment map with a standard Monte Carlo sampling algorithm.  The noise is produced because sometimes the sample rays used for a surface point hit the bright light sources and sometimes they miss.

 

 

To remove this noise we would need to importance sample the environment map.  A technique called Structured Importance Sampling, presented recently at SIGGRAPH '03, solves this problem very nicely.  The basic idea of structured importance sampling is to stratify an environment map and determine which regions are more important.

Using this algorithm the environment map is hierarchically divided up into regions based on pixel intensity.  Each level in the hierarchy represents similar intensities within a given threshold range.  Higher levels in the hierarchy contain the brighter regions.  During the hierarchical thresholding process the regions are are assigned a number.  This number represents the number of samples to be used for the region.  Brighter regions receive more samples then dimmer regions.  Once the sample numbers are assigned, each of these regions are evenly divided into N partitions or stratums where N represents the number of samples assigned for the region.

Below is a rendering that uses standard Monte Carlo to sample the environment.  It is very noisy because the Grace probe contains smaller area light sources as the sun light enters through the windows.  The sampling algorithm used evenly divides the hemisphere above each point into equal sized stratums from which jittered samples are taken.  Sometimes the sample hit the light sources and sometimes they miss.

However, using structured importance sample technique we can first analyze the environment map for important regions.  The images below show the threshold maps for 2 of the hierarchies used in the structured importance algorithm for the grace probe.

 

 
The map above depicts the highest threshold for the grace map and thus contains the brightest regions.  Notice how each of the regions have a different color.  Using an image processing technique pixels can be connected together to form unique regions that we later subdivide into stratums.
 

 
The map above shows regions that contribute less light into the scene.  However, for better shape details these regions have been combined with regions containing brighter pixels.  The lowest threshold level would fill the entire blue area and would be area sampled using standard Monte Carlo techniques.
 

Using information from the hierarchical threshold maps the environment can be appropriately importance sampled.  In the image above I show the samples.  To emphasize the important regions, I left out the samples for the background or lowest threshold.  There is actually a small bug in my implementation of the algorithm.  I am not properly assigning the correct number of samples to the lower threshold levels.  All but the very lowest threshold is treated as equally important as the highest.  However, the results are still very good.

The left image below is setup exactly the same as the noisy image above, except that it is using structured importance sampling.  Look at the multiple shadows generated from the various light sources.  I believe the darkest shadow is created by direct sun light entering one of the windows.

 

StingRay renderings using structured importance sampling on the Grace Cathedral environment map. (Left) uses a white diffuse table top while (Right) a HDR marble material is used.
 
Photon Mapping and HDR Environment Maps
Using the structured importance sampling technique to hierarchically stratify the environment maps I now have the tool to efficiently generate sample points for photon emission.  This means that I can generate caustics and other GI effects using only the light that comes from the HDR environment map.
 

Volume Rendering

In order to render lighting effects within a participating medium I first needed to add support for rendering volumes.  I implemented the ray-marching algorithm which is a common numerical integration technique for rendering volumetric effects.  The basic idea is to recursively step along a ray sampling color and density within a volume or space.  From these samples opacity, shadowing and illumination can be computed and these results are propagated to the next steps.  The algorithm terminates if the integrated opacity or density is fully opaque or the far end of the path in the volume is reached.

I use a shader model where volume shaders are executed at each step to compute the density and color.  The shader is passed standard information such as position, normals, etc.  The normals are computed using finite differencing.  Ken Perlin offers a method where the normal is computed by taking the difference of the density at P and a neighboring density.  Using this method the normal will point in the direction of most change.  The images below show a smoked filled Cornell Box using only direct lighting.

 

No shadows Visualization of the normals N dot L lighting
 
The images below show occlusion effects within the medium from the objects.  For these effects to be computed I needed to add support for shadow rays that are marched along.
 
Orange cloud with shadowing effects. A square hole in floor emphasizes lighting effects.
 

GI in Participating Media

 I will include more information here soon.
 

Deliverables for Project

  • Write up for Participating Media
  • Source Code for StingRay
    • Volume caustics in particpating media
    • GI in fog, smoke, dust, and gases.
 

References

[1] Jensen, Efficient Simulation of Light Transport in Scenes with Participating Media using Photon Maps, Proceedings of SIGGRAPH'98, pages 311-320, Orlando, July 1998
[2] Jensen, Visual Simulation of Smoke, Proceedings of SIGGRAPH'01, pages 15-22, Los Angeles, August 2001
[3] Jensen et al, A Practical Model for Subsurface Light Transport, Proceedings of SIGGRAPH'01, pages 511-518, Los Angeles, Aug 2001
[4] Jensen et al, A Rapid Hierarchical Rendering Technique for Translucent Materials, Proceedings of SIGGRAPH'02, pages 576-581, San Antonio, July 2002.
[5] Jensen et al, Light Scattering from Human Hair Fibers, Proceedings from SIGGRAPH'03, San Diego, July 2003
[6] Pharr et al, Monte Carlo Evaluation of Non-Linear Scattering Equations for Subsurface Reflection, Proceedings of SIGGRAPH'00
[7] Agarwal et al, Structured Importance Sampling of Environment Maps, Proceedings from SIGGRAPH'03, San Diego, July 2003.