Skip to content. Skip to navigation

Illuminate Labs

Sections

Using Global Illumination in Turtle

In this tutorial we are going to demonstrate how to use Turtle's various global illumination features.

Project files: gi_adv.zip

Global Illumination is a term used for algorithms that can simulate indirect illumination effects such as color bleeding and caustics. We will demonstrate how to use photon mapping, final gather and image based lighting and also how to combine the methods to get the best quality in optimal render time.

Note: All frames are rendered on an Dual 2GHz Mac G5 with 1512Mb of ram. The system is running MacOSX 10.3.

The scene is a simple indoor scene consisting of a polygon box with extruded faces and a spotlight.

To get a more physically correct lighting the spotlight Decay Rate is set to Quadratic and the Intensity is set to 2000. The light has Ray traced shadows enabled. Let's render the scene with the default render settings.


Default rendering

Since we have not applied any global illumination yet only the surfaces seen by the spotlight are illuminated.

Photon Mapping

Let's start of by enabling photon mapping. The settings for photon mapping are located in two different places. The render settings are found in the Render Globals under Caustics/Global Illumination. Enable Global Illumination and select Standard Photon Mapping. The settings for Photon Emission is found on the node l_spotShape. Enable Emit Photons and do a render of the scene.
Default photon


First we need to adjust the intensity of the global illumination. The default Photon Energy of 8000 is to high for this scene. We lower the energy until the overall intensity looks nice. In this case we set it to 250.

Photon 250

Now it's time to adjust the quality of the global illumination. There are three attributes that controls the quality of the photon mapping solution:

  • The number of stored photons (l_spotShape -> Global Illum Photons)
  • The number of estimate photons (Render Globals -> Photon Accuracy)
  • The estimate search radius (Render Globals -> Photon Radius)

The first attribute sets the total number of photons that must be stored in the global photon map. The second attribute controls the number of photons to collect from the photon map when estimating irradiance. The third attribute sets the search radius to use when collecting photons in the photon map.

To get good quality in short render time it's important to have some understanding of how the irradiance estimate works. When estimating irradiance using the photon map a search of the nearest photons is performed. The search radius is used to limit the search, and the search is completed when the radius is reached or the number of estimate photons have been found. The energy of the collected photons are then weighted together to estimate the irradiance.

If many photons are stored in the map you will have a better chance to get a good estimate. However if more photons are emitted the emission pass will take a longer time. More photons also consumes more memory. The trick is to find a good quality/performance ratio. If the radius or the number of estimate photons (Photon Accuracy) is too small you will get noise since not enough photons are used to get a good estimate. If the radius is too large you will lose smaller details since a too large area is included in the estimate. The following renderings demonstrates the concepts explained above.

Number of Stored Photons


Photon 250
  • Stored Photons: 10.000
  • Photon Accuracy: 100
  • Photon Radius: 1
  • Render time: 5.4s


  • Stored Photons: 100.000
  • Photon Accuracy: 100
  • Photon Radius: 1
  • Render time: 15s



  • Stored Photons: 1.000.000
  • Photon Accuracy: 100
  • Photon Radius: 1
  • Render time: 1,33m

With more stored photons you get a better estimate and a better chance to capture all details in the scene. However the photon emission pass increases a lot. 100.000 seems to give a good quality/performance ratio in this scene.

Number of estimate photons



  • Stored Photons: 100.000
  • Photon Accuracy: 10
  • Photon Radius: 1
  • Render time: 14s



  • Stored Photons: 100.000
  • Photon Accuracy: 100
  • Photon Radius: 1
  • Render time: 16s


  • Stored Photons: 100.000
  • Photon Accuracy: 1000
  • Photon Radius: 1
  • Render time: 55s

Few estimate photons results in a lot of noise, and too many results in unnecessary long render times. about 300 will will work with this scene.

Photon search radius




  • Stored Photons: 100.000
  • Photon Accuracy: 1000
  • Photon Radius: 0.25
  • Render time: 16s



  • Stored Photons: 100.000
  • Photon Accuracy: 1000
  • Photon Radius: 1.0
  • Render time: 17s

100.000 photons

  • Stored Photons: 100.000
  • Photon Accuracy: 1000
  • Photon Radius: 1
  • Render time: 55s

A small radius results in noise and if the radius is too large all details are lost. Note that the radius is given in world space units and hence must be adjusted to the size of the scene. 1.0 gives a good result in this scene.

Combining the settings derived above gives the following rendering.


  • Stored Photons: 100.000
  • Photon Accuracy: 300
  • Photon Radius: 1
  • Render time: 17s

The quality of photon mapping alone is often not sufficient for final renderings. To get higher quality we need to combine it with final gathering. We will look at this in a moment but first lets take a look at some speed-up methods that we can use to make the photon map queries faster.

Precalculate Irradiance

The first method is to precalculate the irradiance in the photon map before the rendering starts. Checking Precalculate Irradiance will enable this. The attribute Precalc. Step controls how many precalculated values will be stored in the map. A longer step gives faster photon map queries, but lower accuracy.

  • Precalc Step: 1
  • Render time: 15s



  • Precalc Step: 2
  • Render time: 13s


  • Precalc: 3
  • Render time: 13s


  • Precalc Step: 8
  • Render time: 12s

Liquid Light Photon Mapping

The second method is to enable Liquid Light Photon Mapping (LLPM). This algorithm is not as accurate as Standard Photon Mapping but on the other hand it's much faster. The attribute Grid Cells will be available with LLPM, this attribute controls the resolution of the LLPM solution. A higher grid resolution gives more details but it takes more memory and longer render time. The following renderings show LLPM at different grid resolutions.


  • Grid Cells: 10.000
  • Render time: 11s


  • Grid Cells: 100.000
  • Render time: 11s


  • Grid Cells: 1.000.000
  • Render time: 12s

As can be seen from the render times above, using Precalculate Irradiance or LLPM can save a lot of time. The speed-up is even more noticeable when using photon mapping with final gather.

Final Gather

Final Gather is another algorithm used to calculate global illumination. It calculates the irradiance at selected sample points in the scene by shooting many rays and gathering light from other surfaces. Let's disable Photon Mapping for now and enable Final Gather instead.

There are three attributes that controls the quality of the final gather solution:

  • The number of gathering rays (Render Globals -> Gathering Rays)
  • The number of sample points (Render Globals -> Accuracy)
  • The smooth radius (Render Globals -> Smooth)

Gathering Rays sets the number of rays to use then estimating the irradiance at each sample point. The second attributes controls how many sample points are created, a higher Accuracy gives more sample points. The third attribute sets the radius of a smoothing filter that can be used to Smooth the final gather solution and reduce artifacts and noise.

The default setting is quite high for preview renderings so we lower it to 300 Gathering Rays and 0.5 Accuracy. We can get multiple bounces of indirect light by adjusting the Final Gather Depth attribute. Let's render the scene with different final gather depths.


  • Gathering Rays: 300
  • Accuracy: 0.5
  • Smooth: 1
  • Final Gather Depth: 1
  • Render time: 12s

  • Gathering Rays: 300
  • Accuracy: 0.5
  • Smooth: 1
  • Final Gather Depth: 2
  • Render time: 18s

  • Gathering Rays: 300
  • Accuracy: 0.5
  • Smooth: 1
  • Final Gather Depth: 3
  • Render time: 21s

As can be seen from the render times it's quite expensive to calculate more than one bounce of light (FG Depth > 1) with final gather alone. That is because the number of gathering rays increases exponentially with the number of light bounces. We can alleviate this by combining final gather with photon mapping. Since the photon map contains many bounces of indirect light (set by the Max Photon Depth attribute), we can shade the first level of gathering rays using the photon map.

Each final gather sample point is an average of many gathering rays, so the quality of the photon map is not so important in this case. Hence we can use the speed-up techniques from above to make the photon map queries fast.


  • Gathering Rays: 300
  • Accuracy: 0.5
  • Smooth: 1
  • Final Gather Depth: 1
  • Photon Map Precalc Step: 4
  • Rendertime: 12s



  • Gathering Rays: 300
  • Accuracy: 0.5
  • Smooth: 1
  • Final Gather Depth: 1
  • LLPM Grid Cell: 100000
  • Render time: 11s

LLPM gives the fastest rendering and the same quality so we will use that in the following renderings.

We still have some artifacts and to remove them we can increase the number of sample points and/or gathering rays. If we render with the External Renderer (Memory and Performance -> Render Using -> External Renderer) we can diagnose the sample points. Right click and choose Diagnostics -> Final Gather Map.


To get more sample points we increase the Accuracy attribute, set it to 1.0. We also increase the Gathering Rays to 1000 for our final rendering.



  • Gathering Rays: 1000
  • Accuracy: 1.0
  • Smooth: 1.0
  • Final Gather Depth: 1
  • LLPM Grid Cell: 100.000
  • Render time: 23s
Return to Tutorial index

Last modified 2006-07-12