Global Illumination describes several algorithms used to calculate non-direct lights in game engines. In Godot, it’s implemented using the GIProbe node, which can calculate emissive lights and secondary reflections, giving you more accurate lighting in your scene at the cost of performance. In this tutorial we will go step by step through the process of setting up a GIProbe. You can learn more in the video embedded below.
The first step for setting up global illumination is to go through the scene, select each model that will participate in the calculations and select Use in Baked Lighting in the Geometry Instance section.
Once you have your models set to participate, it’s time to create a GIProbe node. Add a new Node to the Scene (doesn’t matter who it is parented to) of type GIProbe.
Now size the GIProbe box using the red/pink control handles, so that it envelops your scene. You can have multiple GIProbes per scene and having them overlap serves no purpose.
Now with at least one light source in the scene, with GIProbe selected, click Bake GI Probe in the menubar.
This will calculate the indirect lights in your scene. You can also have a GIProbe calculate the effects of emissive lights in your scene. Emissive lights are lights that are projected from textures. In a SpatialMaterial you can turn emissive on in the Emission tab by selecting Enabled. Emission is the color of the light emitted, while energy is the strength of the energy emitted.
Emissive lights will only be shown after being baked by a GIProbe. Emissive lights cannot move without baking the scene again. You can cause a GIProbe to bake lights in code using the following code:
get_node("../GIProbe").bake()
This is an expensive operation and should not be performed lightly.
There are a couple of ways to control the quality of the lighting generated by a GIProbe. The first is by setting the Subdiv property in the GIProbe.
The higher the resolution, the better the results but more expensive the calculations. You can also change the quality of lighting in Project Settings by enabling High Quality in Voxel Cone Tracing.
Once again, this is a trade off between quality and performance. Finally I should point out that GIProbe only works with the OpenGL ES3 renderer, not in ES2. On ES2 you are instead stuck with traditional Light Baking, which takes less processing power, but produces inferior and less dynamic results.
Another thing to be aware of is dealing with the GIProbe inside the Godot Editor. The GIProbe, as shown above, is a giant green lattice, which can make viewing your scene somewhat difficulty. You may be tempted to hide the GIProbe like so:
Unfortunately this turns the GI off completely! If instead you want to hide the GIProbe in the viewport, you turn it off in the viewport menu. In the viewport, select View->Gizmoes->GIProbe.
This value is a toggle and controls ALL GIProbes in the scene.
You can learn more about Global Illumination and GI Probes in the video below.
Programming Design