Lightmapping Troubleshooting Guide

Chapter 23: Redundant light probes


Figure 54. Screenshot from the Adventure Sample Game. Scene still contains light probes from an unloaded scene (left). Calling the LightProbes.TetrahedralizeAsync removes the redundant light probes upon loading a new scene (right).

23.1 Why does this happen?
Unity uses tetrahedral space mapping to determine which light probes to use for illuminating dynamic GameObjects. When loading and unloading scenes containing light probes, it is important to recalculate the tetrahedral mapping. Failure to do so will result in incorrect shading for probe-lit objects.

23.2 How to fix it?
23.2.1 Recalculate probe tetrahedra using the API
You can use LightProbes.Tetrahedralize to recalculate light probe tetrahedra after loading and unloading scenes. Wait for the LightProbes.needsRetetrahedralization event to finish before making the API call. Upon successful execution, Unity will reintegrate additively loaded probes into the tetrahedral structure, and will remove the unloaded probes.

23.2.2 Adjust level design


Figure 55. Screenshot from the Additive Loading Lighting Examples project. This example consists of three scenes: one containing the green corridor (Scene A), another one with the blue room (Persistent Scene), and the last one housing the red corridor (Scene B). We built it in such a way that light probes overlap in the blue room only. This ensures a seamless lighting transition when loading and unloading scenes.

To avoid issues with redundant or overlapping probes, some adjustments to level design and additive loading approach might be necessary.

In the example above, the project setup ensures that there will be a seamless lighting transition when moving between the scenes. Here is how we built this example project:

  • Persistent Scene which contains a blue room, and some probe-lit objects. It contains no light probes. This scene is always loaded and will act as a transitional area.
  • Scene A which contains a green corridor, and some probe-lit objects. It contains a light probe group that envelops Scene A and the Persistent Scene. This scene is additively loaded on demand.
  • Scene B which contains a red corridor, and some probe-lit objects. It contains a light probe group that envelops Scene B and the Persistent Scene. This scene is additively loaded on demand.

To learn more about additive lighting, please check out the Additive Loading Lighting Examples project in the Asset Store.

5 Likes