Version: Unity 6.7 LTS (6000.7)
Language : English
Global Illumination Profiler module reference
Precalculating indirect light with Light Probes

Real-time global illumination with Surface Cache

Surface Cache Global Illumination (GI) calculates indirect diffuse lighting while your application runs. It needs no baking and no precomputation, so when you move a light, open a door, or change the time of day, indirect lighting follows within a few frames. You also see the result in the Editor as you work, without waiting for a bake.

Surface Cache GI is available in the Universal Render Pipeline (URP) only. It replaces baked GI rather than adding to it, so adopting it is a decision about your whole lighting approach, not an effect you layer on top.

This page explains how Surface Cache GI works, what it requires, and the limitations to weigh before you adopt it. To compare it with the other ways Unity produces indirect lighting, refer to Introduction to global illumination.

How Surface Cache GI works

Surface Cache GI stores indirect lighting on the surfaces of your scene rather than in lightmaps or probes. It works in the following stages:

  1. Divide surfaces into patches. Inside the Surface Cache volume, Unity subdivides camera-visible surfaces into small areas called patches. A grid of cascades controls patch size, so surfaces near the camera get smaller patches and more lighting detail than surfaces in the distance.
  2. Trace rays from each patch. Each frame, Unity casts a number of rays from each patch to find the light arriving at it. When a ray hits another surface, the patch can read the lighting already stored there. This is how light bounces more than once.
  3. Accumulate and filter. A single frame of rays is too noisy to display, so Unity combines each patch’s new samples with the results of previous frames, and can also blend lighting across neighboring patches. This makes lighting settle over several frames rather than appearing complete at once.
  4. Resolve to the screen. Unity reads the patch lighting into a full-screen buffer of indirect light, which lit shaders sample in place of lightmap or probe lighting.

Because the cache follows the camera, lighting is most accurate where the player is looking, and surfaces that have just come into view take a moment to reach full quality.

Lighting that Surface Cache GI produces

Surface Cache GI produces indirect diffuse lighting on opaque surfaces inside the Surface Cache volume. It doesn’t produce specular reflections, and it doesn’t light transparent materials. Use Reflection Probes for specular reflections. Transparent materials receive lighting from the ambient probe.

Unity stops applying indirect light from lightmaps and Adaptive Probe Volumes to opaque surfaces while Surface Cache GI is active. Surface Cache GI also keeps its own copy of mesh and surface color data, which uses a significant amount of video memory.

Requirements

Surface Cache GI requires the following:

  • A project that uses URP.
  • A device that supports compute shaders.
  • Static Batching disabled, because Surface Cache GI reads the original mesh data. Refer to Enable static batching.
  • Default Mesh Buffer Target set to Raw, so that shaders can read every mesh. Refer to Graphics project settings reference.

Unity automatically uses hardware ray tracing when your device supports it, and falls back to ray tracing in a compute shader when it doesn’t. The compute path is slower, so take this into account when you compare performance across devices.

Limitations

Surface Cache GI doesn’t react to the following, which can produce lighting that looks wrong rather than lighting that is simply absent:

  • Alpha clipping. Unity treats every triangle as opaque, so materials that rely on alpha cut-outs, such as foliage, block and bounce light as though they were solid.
  • Skinned meshes as light sources. Characters and other skinned meshes receive indirect lighting, but don’t bounce light onto their surroundings.
  • Some material changes. Changing a property on a standard Lit material, such as its color or intensity, updates correctly. A custom shader that changes appearance through code, such as one driven by the _Time uniform, may not be detected, and Surface Cache GI keeps using the appearance it last captured.
  • Skybox changes driven from outside the material. Surface Cache GI updates its environment lighting when it detects a change to the skybox material, but not when a skybox shader changes through a global value, such as one animated with the _Time uniform. In that case, indirect lighting keeps using the environment Unity captured last.

Reflection Probes are a separate case. They work alongside Surface Cache GI, but they don’t capture its contribution, so reflections don’t show indirect diffuse lighting.

Additional resources

Global Illumination Profiler module reference
Precalculating indirect light with Light Probes