Realtime Global Illumination
Your first document
Realtime Global Illumination
Unity's Realtime Global Illumination (GI) system relies on Enlighten, so that lighting precomputes take minutes rather than hours. It is useful for Lights that change slowly and have a significant visual impact on our game. This includes the sun moving across the sky, or a slowly pulsating light in a closed corridor.
This system allows us to work with precomputed lighting, which is the process of calculating the bounce of light around the static geometry within a scene in the Unity Editor and storing this data for use at run time. This process reduces the number of lighting calculations that must be performed at run time, allowing realtime bounced lighting while maintaining interactive frame rates.
-
Step 1: Read Documentation on Realtime GI First read the documentation on Realtime Global Illumination: Introduction to Realtime Global Illumination using Enlighten
-
Step 2: Enable Enlighten Realtime Global Illumination Enable Realtime Global Illumination in your Scene by going to
Window
>Rendering
>Lighting
then enableRealtime Global Illumination
.Recall that baked lightmaps are textures that store the lighting. They are cheap at runtime but take time to generate. To generate lightmaps, we use the
Lighting
window. SelectBaked Indirect
as your Lighting Mode.Then, select
Progressive GPU
as the progressive Lightmapper. If you like, you may customize sample counts and denoising options. Feel free to check out the documentation: Enble Enlighten Realtime Global Illumination -
Step 3: Baked Lightmaps For the objects to participate in the Global Illumination (GI) computation, we will need to check Contribute Global Illumination in our meshes. Make sure they all receive lighting from our lightmaps.
-
Step 4: Reflection Probes Reflection probes help capture local specular lighting. They are objects that can capture the surrounding environment into a cube map. The cube map is then used to provide specular lighting to the nearby objects.
Lets start with adding a reflection probe in front of the camera.
By default, it is a baked reflection probe and looks like a black sphere. Once baked, it has successfully captured the surrounding environment.
To capture correct local reflections, we need to place more reflection probes. Updating the bounds, the capture point, and the fade distance for each probe can be a time-consuming task.
How should we place our relection probes? We can group them by the same lighting condition. If they have the same lighting condition, we can share the same reflection probe. Usually the more probes, the more exact the reflections. However, this will have a memory cost.
To test your reflections, you may change your materials to Mirrors.
-
Step 5: Generate Lighting In the
Lighting
panel, we can then press onGenerate Lighting
to produce lightmaps. Using the Unity Realtime Global Illumination system with Enlighten, it should take a couple of minutes to generate or less than a minute. During this time, the lightmaps are gettting denoised, compressed, and stored as EXR. -
Step 6: Rendering Debugger We may also visualize our work with the Rendering Debugger. Open the debugger by going to
Window
>Analysis
>Rendering Debugger
. When in Play Mode, we can pressLeftCtrl
+Backspace
(LeftCtrl
+Delete
on macOS). On a console controller, pressL3
andR3
(Left Stick and Right Stick).Feel free to read the documentation: Rendering Debugger