Runtime GI Probes: Documentation

Table of Contents

1. Requirements

Runtime GI Probes was originally made on Unity 2021.3.8f1, and on the Universal Render Pipeline 12.1.7. If there are issues with running on slightly older versions of Unity or the URP, first check to see if any errors were made during setup before deciding on upgrading your Unity project.

Runtime GI Probes does not replace real-time lighting, meaning it will not create shadows like Unity’s built-in light mapping solution. Also, URP’s SSAO or Deferred Rendering needs to be enabled to create the “_CameraNormalsTexture” which is necessary for Runtime GI Probes to know world space normal information. Therefore, it is not recommended for mobile or Quest 2 standalone since real-time lighting combined with SSAO or Deferred Rendering may be too expensive in terms of performance for the average game running on those platforms. Runtime GI Probes is better suited for gaming PCs and modern gaming consoles. Although, it is possible to run on modern mobile devices that support Vulkan at lower settings. 

2. Basic Setup

Before you can run the demo scene, the most basic steps are:

This will activate the GIProbesRPAsset, which is preconfigured with the GI Render Feature. At this point global illumination should be visible in the demo scene. The GIProbesRPAsset is set up with Screen Space Ambient Occlusion and Screen Space Shadows. To improve performance, you can lower the quality of SSAO. SSAO must use Depth Normals and not Depth, or you can set the rendering mode of the GIProbesRPAsset to Deferred instead of Forward and completely disable the SSAO Render Feature.

3. Advanced Setup

Assuming the basic setups steps have been completed and you wish to add Runtime GI Probes to a new or existing scene, the steps are:

The GILightBaker has all the GIProbes parented to it. You can duplicate and move them to fit the scene. You can view the results of the light baking in the inspector window.

The GIBoundingBox is used to contain the effect of the global illumination. For example, a sunny outdoor scene with a dark cave can have a bounding box filling the cave only.

The GI Basic Camera is a camera setup to view the global illumination. It contains the GI Camera Properties component, with the GI Camera Shader material pre-assigned.

4. VR Support

Runtime GI Probes supports VR using the Open XR package and single pass / multi-view rendering or multi pass rendering:

Following the above steps will allow you to see the global illumination in mock runtime, but it should still work using a VR headset. The default GIVRCamera is a camera setup to work in VR by setting the VR Camera Boolean to true in the GI Camera Properties component and setting target eye to Both on the Camera component.

5. Mobile Support

Runtime GI Probes supports mobile through Vulkan:

On mobile, please lower the light map resolution settings on the GI Render Feature to a maximum of 64. The baking times will be too long if greater than that. To accommodate larger scenes, you will have to increase light map scaling at the expense of resolution. 

6. Component Inspector Variables

GILightBaker variables:

GIBoundingBox variables:

GIProbeProperties variables:

GICameraProperties variables:



 7. GI Render Feature Inspector Variables

GIRenderFeature variables:

8. Shader Variables

GICameraShader variables:

9. Runtime GI Probes API

Below is a list of functions that can be called from your own scripts when using the GIProbesRuntime namespace. If there is a change in the lighting of a scene, the GILightBaker can be passed a list of its GI probes to update before telling the GIRenderFeature to recalculate the lightmaps.

If you want to change lightmap settings in real-time, the GIRenderFeature will recalculate the lightmaps with your updated settings. If you want to add new cameras to a scene or add new GIBoundingBoxes to a scene in real-time, you will have to notify the GIRenderFeature.

10. Limitations

Runtime GI Probes will render before transparent objects, meaning transparent objects will be excluded when applying global illumination. This can be a problem if you have an existing project that makes heavy use of those kinds of materials for vegetation, water, or hair. Also, this can make Runtime GI Probes incompatible with other Unity assets that make use of transparent materials. For example, Runtime GI Probes would not work with Unity’s built-in grass billboards since they use a transparent material. Opaque materials with alpha clipping are an exception to this since they are not transparent.

The maximum Light map resolution is 256 x 256 x 256. On mid to high end PC hardware, this size will produce a small lag spike. However, a size of 512 x 512 x 512 results in the computer freezing for a minute and a half since this is exponentially bigger. This is unacceptable and of course, anything larger than this is out of the question. On mobile devices, the maximum should be 64 x 64 x 64.

Lowering the resolution of the light checker texture can cause holes to appear in the texture since the material uses alpha clipping to hide objects behind in the depth buffer. If the light checker resolution is smaller than the depth buffer texture, there can be errors. The Shader Graphs Light Checker Shader material has a depth error variable to help correct this by lowering it. The desktop version has a depth error value of -0.01 since it is expected that the resolution be at 1 or 100%. The mobile version of the material is set to -0.5. The only way to completely remove artifacts though would be to set the light checker resolution at 1.

In a scene there can be a maximum of 128 GI Bounding Boxes.

11. Tips

If you want to move or edit GI Bounding Boxes, you can do that in real-time without having to call any functions in code. If you want to add a GI Bounding Box to your scene, you are going to have to call the UpdateBoundingBoxInfo function on the GI Render Feature or turn off the GI Render Feature and turn it back on again, since it automatically looks for all GI Bounding Boxes in its Create function.

Emissive materials become muted by the global illumination, since the effect of GI dimming overpowers the brightness of emission in materials. To work around this, you can make emissive materials transparent. If the environment lighting is too dark, the result of the light bake may be too dark. Try keeping some ambient lighting even in night time scenes, and let the GI make areas pitch black if it is appropriate.

If you have a larger area you want to cover with global illumination, make use of the scaling options in the GI Render Feature or move the origin point / offset of the lightmap in the GI Render Feature depending on player position. Disabling GI probes can speed up light baking times, so if the player is in one location, you can disable all other GI probes to reduce the GI Light Baker’s work load. At lower resolutions or larger scales, you may need to increase the influence minimum distance of GI probes to avoid making a scene too dark.

Getting the right lighting may take a couple iterations of placing around GI Probes and seeing if it looks good. In general, you do not need many GI Probes to capture the global illumination of a simple room and it is better to keep the GI setup simple. Use the demo scene for reference, you would be surprised at how a small number of GI probes can illuminate a large area. The result is not going to have the level of detail found in a traditional baked lightmaps; the idea is to capture subtle ambient lighting like SSGI (Screen Space Global Illumination).