Version: Unity 6.3 LTS (6000.3)
Language : English
Prevent light leaks with rendering layer masks
Configure APV rendering layer masks and verify probe assignments

Light leak prevention with rendering layer masks

Prevent light leaks by restricting which light probesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
See in Glossary
a renderer can sample with rendering layer masksA value defining which layers to include or exclude from an operation, such as rendering, collision or your own code. More info
See in Glossary
.

Adaptive Probe Volumes (APVs) yield good results for exterior scenesA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
and dynamic objects. Thin or complex static geometry can still leak light because pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary
interpolate between probes in different spaces.

To prevent light from leaking through boundaries such as walls and ceilings, restrict which probes a renderer samples to maintain distinct lighting across adjacent spaces.

Rendering layers and rendering layer masks

A rendering layer defines how Unity applies specific effects across different objects. Rendering layers are selection groups you assign to objects. Rendering layers let lights, decals, shadows, and custom passes include or ignore specific objects.

A rendering layer maskA bitmask that aggregates multiple rendering layers. By assigning one or more rendering layers to an object’s MeshRenderer or an effect such as light, decals, or APVs, you can control how and where Unity applies the effect in the scene.
See in Glossary
is a bitmask that aggregates multiple rendering layers. Assign one or more rendering layers to an object’s MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary
Renderer. You can also assign layers to effects such as lights, decals, or APVs. This controls how and where Unity applies the effect in the scene.

For example, define the following rendering layers and the following rendering layer mask. For more information, refer to Configure APV rendering layer masks and verify probe assignments.

Rendering layers Rendering layer mask
Interior 0
Exterior 1
Lower 1
Upper 0

A pixel or vertex preferentially samples light probes in the same rendering layer. For example, a pixel in the Exterior layer preferentially samples probes in that layer. To fine-tune which light probes a pixel or vertex samples, change the leak reduction mode.

APV rendering layer workflow

Unity bakes APV probes based on rendering layers using the following workflow:

  1. Set which rendering layers APVs must consider.
  2. Assign rendering layers to key GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
    See in Glossary
    in an area.
  3. Unity automatically associates a rendering layer with each probe.
  4. At runtime, eight probes surround each pixel. The rendering layer masks prioritize probes that are in the same layer as the pixel.

How rendering layer masks work with APVs

Rendering layer masks restrict which probes a renderer samples based on baked rendering layer regions.

A dark, unlit interior of a box on the right and a simple gradient sky and ground on the left. Adaptive Probe Volumes dont use rendering layers, resulting in light leaking. The exterior appears slightly darker, while the interior is noticeably brighter.
A dark, unlit interior of a box on the right and a simple gradient sky and ground on the left. Adaptive Probe Volumes don’t use rendering layers, resulting in light leaking. The exterior appears slightly darker, while the interior is noticeably brighter.
A dark, unlit interior of a box on the right and a simple gradient sky and ground on the left. Adaptive Probe Volumes use rendering layers, and light doesnt leak. Interior and exterior surfaces now prioritize sampling probes from the same Rendering Layer.
A dark, unlit interior of a box on the right and a simple gradient sky and ground on the left. Adaptive Probe Volumes use rendering layers, and light doesn’t leak. Interior and exterior surfaces now prioritize sampling probes from the same Rendering Layer.

Unity defines up to four rendering layer masks in the baking set and applies them during baking. You can set local exceptions via a Probe Adjustment Volume.

If a renderer’s mask doesn’t match any of the rendering layer masks in the baking set, the APV samples all valid probes.

Note: Rendering layer masks increase bake time and memory usage.

Additional resources

Prevent light leaks with rendering layer masks
Configure APV rendering layer masks and verify probe assignments