In real life, light photons originate from light sources, they bounce off a number of surfaces, have their colors modified by these surfaces and eventually reach our eyes. In computer graphics, Global Illumination (GI) attempts to simulate those photon bouncing interactions. This simulation adds realism to lighting and helps achieve more life-like images.
GI can have a profound effect even on extremely simple scenes, as shown below:
On the left, without GI; on the right, with GI. Notice the color bleeding
Light that reaches object surfaces without any bounces is referred to as direct lighting. Once light has bounced off one or more surfaces it is referred to as indirect lighting. So what GI essentially computes is indirect lighting. When a photon hits a rough surface, it gets scattered around randomly. This is called Diffuse Global Illumination.
Diffuse Global Illumination can be achieved with a combination of the following techniques:
- Photon mapping
- Irradiance caching
- Irradiance point cloud
Primary And Secondary GI Engines
Among the techniques mentioned above, photon mapping is the only one that works similar to how lighting works in real-life, i.e. it shoots photons from the lights. All the other techniques work the reverse way: they shoot rays out of the camera, bounce them around and eventually hit a light.
When these camera rays hit an object, the primary GI Engine is used. If GI requires multiple bounces, the secondary GI Engine is used for these bounces. The figures below show how this happens when you enable “brute force” for both primary and secondary GI engines.
Zero GI Bounces. Camera shoots a ray and hits wall (point “A”). The primary GI engine is used and shoots another ray of which is shown in red. This way, direct lighting on the floor (point “B”) affects point “A”.
One GI Bounce. The processing now goes a bit further. Point “B” uses the secondary GI engine to gather illumination from the sphere by shooting a single ray (shown in blue). This way, the direct lighting of the floor (point “B”) and the sphere (point “C”) affects point “A”.
Shooting photons from the lights or shooting rays from our eyes are, in some ways, equivalent. If you flip the direction of all the arrows above it’s as if lighting came from the light source, bounced off the sphere, floor, wall and then reached the camera!
So why have separate primary and secondary GI engines? The results of primary GI lighting are directly visible to the camera so needs to be as high-quality as possible. Secondary GI lighting, on the other hand, often represents a smallest part of the final lighting so it can afford to be of somewhat lower quality (think “blurrier” or “noisier”) without introducing significant visual artifacts. Approximating secondary GI like that has significant performance and, sometimes, quality advantages!
Please note that the examples above only show what happens with “brute force”. Other GI engines do different things for points A, B, C. These are described in more detail under each technique’s documentation.
GI Engines and Number of Bounces
The starting point for enabling GI is selecting the primary and secondary GI Engines and specifying the number of GI bounces.
Introducing more GI bounces in your scene will often make your lighting brighter – and the rendering slower. It also tends to “wash out” the lighting a bit, too. For these reasons users sometimes choose to limit the number of bounces.
The scene shown below contains a few vertical tiles, one of which is lit with a strong spotlight. The biggest visual difference (for this particular scene) is between 0 and 1 GI bounces.
Left: Zero GI Bounces. Center: One GI Bounce. Right: Two GI Bounces.
In the images above:
- Zero GI Bounces: The right tiles are lit by the direct lighting on the center illuminated tile.
- One GI Bounce: The indirect lighting on the right tiles is now bouncing off once and illuminating the left tiles. The ground below the right tiles now also receives extra illumination.
- Two GI Bounces. The indirect lighting of the left tiles is now affecting the ground below them. The effect is definitely more subtle compared to the difference between zero and one GI bounce.
Sometimes users are overwhelmed by the multitude of choices and ask for the best settings.
While different scenes will have different requirements, we’ve found that a good starting point is this:
- Set the Primary GI Engine to “Brute-Force”
- Set the Secondary GI Engine to “Point Cloud”
- Set the “Number of GI Bounces” to 2 or 3
As a rule of thumb, try to remember the following points regarding GI quality:
- Scenes containing several (not too strong) lights can typically get away with fairly low GI settings (number of rays, number of samples, etc)
- Scenes that contain very few, very strong lights will need more aggressive GI settings. For example, the “single lit tile” scene above required many rays to get a clean result because it was almost entirely indirectly lit and using only a single very strong light.
- Outdoor scenes that are lit with environment shaders (like “physical sky”) can typically get away with fairly low GI settings
To summarize all of the above: lots of lighting contrast requires higher quality settings, lower contrast can get away with lower quality settings