KitchenChaos/Library/PackageCache/com.unity.render-pipelines..../Documentation~/2d-light-batching-debugger.md

3.1 KiB

Light Batching Debugger

Light Batching Debugger allows for visualization of how Lights and Shadow Casters are batched according to their associated Sorting Layers in the scene. The tool compares adjacent batches and highlights which Lights or Shadow Casters would be needed to be added or removed in order to be batched together.

How to use

To open the debugger, go to Window > 2D > Light Batching Debugger. Light Batching Debugger window


Light Batching Debugger updates in real time if the Game View is opened. ![Light Batching Debugger window](Images/2D/light-batching-debugger-1.png)
Select on a batch to view Lights and Shadow Casters in the current batch. ![Light Batching Debugger window](Images/2D/light-batching-debugger-2.png)
Individual batches are color coded differently, to indicate they are not batched together.
![Colorcoded](Images/2D/light-batching-debugger-color-1.png)

Sorting Layers that are batched together have the same color.
Colorcoded


Select on adjacent batches to compare the differences between them. Lights and Shadow Casters are displayed in their own panel. The game objects highlighted here only exist in one batch, and are potentially batchable if targeted to both Sorting Layers. ![Light Batching Debugger window](Images/2D/light-batching-debugger-3.png)

Examples

In order for Sorting Layers to be batched, they need to satisfy the following conditions:

  • share the same sets of Lights
  • share the same sets of Shadow Casters

Here are some examples of how Lights and Shadow Casters are batched:

Example scene has 2 Sorting Layers, BG and Default.

Batch Case 1

Batch Case 1 Batch Case 1
Light A and B targeting BG and Default
Shadows disabled
Does batch
Batch Case 2
Batch Case 2 Batch Case 2
:-: :-:
Light A targeting BG and Light B targeting Default
Shadows disabled
Does not batch
Batch Case 3
Batch Case 3 Batch Case 3
:-: :-:
Light A and B targeting BG and Default
Shadows enabled for both Lights
Shadow Caster targeting BG and Default
Does batch
Batch Case 4
Batch Case 4 Batch Case 4
:-: :-:
Light A and B targeting BG and Default
Shadows only enabled for Light A
Shadow Caster targeting BG and Default
Does batch
Batch Case 5
Batch Case 5 Batch Case 5
:-: :-:
Light A and B targeting BG and Default
Shadows enabled for both Lights
Shadow Caster targeting only BG
Does not batch