Bake and Test Occlusion Culling in Unity 2022.3
Occlusion culling prevents Unity from rendering GameObjects that a camera cannot see because opaque scene geometry blocks them. The workflow requires eligible static geometry, baked visibility data, and camera-based visualization.
Begin with a stable section of the scene containing solid walls and objects hidden behind them.
- Mark solid, unmoving blockers as Occluder Static.
- Mark unmoving renderers that may be hidden as Occludee Static.
- Bake the data, select a camera, and inspect the result in Visualization.
Configure and bake the data in the Creator Companion world project. After the Unity visualization passes, test the same rooms, doorways, paths, and elevated viewpoints inside the world.
Occlusion Culling and Frustum Culling
Unity uses these camera-visibility systems for different cases:
| System | Renderer position | Result |
|---|---|---|
| Frustum culling | Outside the camera's view volume | Unity does not render it. |
| Occlusion culling | Inside the view volume but hidden behind baked occluders | Unity can stop rendering it. |
Occlusion culling requires precomputed data because Unity needs a representation of which scene regions can see other regions.
Select Static Occluders
A Static Occluder contributes blocking geometry to the bake. Unity 2022.3 requires an occluder to:
- Have a Terrain or Mesh Renderer.
- Be opaque.
- Remain unmoved at runtime.
Medium and large solid objects such as walls and buildings are documented candidates.
Avoid assigning Occluder Static to geometry that:
- Moves, rotates, scales, or becomes repositioned at runtime.
- Is transparent.
- Contains openings that do not match its visible shape.
- Is too small or thin to be a reliable blocker.
When an occluder uses an LOD Group, Unity uses its LOD0 GameObject to determine what it blocks. A large silhouette change between LOD0 and later levels can make that object unsuitable as a Static Occluder.
Select Static Occludees
A Static Occludee is an unmoving renderer that can be hidden by a Static Occluder. Unity requires it to:
- Have a Renderer component.
- Remain unmoved at runtime.
Unlike a Static Occluder, a Static Occludee may be small or transparent. One GameObject can carry both flags when it qualifies as a solid blocker and can also be hidden.
Use the roles deliberately:
| Scene object | Occluder Static | Occludee Static |
|---|---|---|
| Opaque, unmoving wall | Yes | Usually yes |
| Unmoving room prop | Usually no | Yes |
| Unmoving transparent renderer | No | Yes |
| Moving or animated object | No | No; use Dynamic Occlusion behavior instead |
Set the Static Flags
- Select the GameObjects that qualify as Static Occluders.
- In the Inspector, open Static Editor Flags.
- Enable Occluder Static.
- Select the unmoving renderers that may be hidden.
- Enable Occludee Static.
- Confirm that no object carrying either flag will move at runtime.
An object can have both flags. Do not enable every static flag automatically; this procedure concerns the two occlusion flags.
Enable the Camera Setting
Occlusion culling must also be enabled on the Camera:
- Select the camera used to inspect the scene.
- Find its Camera component.
- Confirm Occlusion Culling is enabled.
Repeat this check for any additional cameras that should use the baked data.
Open the Occlusion Culling Window
Choose Window > Rendering > Occlusion Culling.
The Unity 2022.3 window contains:
| Tab | Purpose |
|---|---|
| Object | Inspect and change occlusion settings for selected renderers or Occlusion Areas. |
| Bake | Configure parameters and generate the occlusion data. |
| Visualization | Preview the result from a selected camera. |
Understand the Bake Parameters
Open the Bake tab before generating data.
| Parameter | Unity definition | Adjustment effect |
|---|---|---|
| Smallest Occluder | Smallest object size, in metres, allowed to hide other objects | Lower values capture smaller blockers but increase bake cost and data size. |
| Smallest Hole | Diameter, in metres, of the smallest gap a camera should see through | Lower values preserve smaller openings but increase bake detail. |
| Backface Threshold | Controls removal of regions likely to be beneath or inside occluder geometry | Changes data size and how enclosed back-facing regions are treated. |
Use Set Default Parameters when the existing values are unknown. Tune one parameter at a time after inspecting the baked result.
Do not enter copied values without considering the scene's scale. A doorway, vent, or gap must be measured in the same metre-based units used by Smallest Hole.
Bake the Occlusion Data
- Save the scene.
- Open the Bake tab.
- Review the three bake parameters.
- Click Bake.
- Wait for Unity to finish generating the data.
Unity saves the generated data as a project asset and links it to the current scene.
Rebake after changing:
- Static occluder geometry.
- Openings such as doors, windows, or corridors.
- Occluder or Occludee Static flags.
- Occlusion Areas or view volumes.
- Major scene scale or layout.
- Bake parameters.
Visualize the Result
- Keep the Occlusion Culling window and Scene view visible.
- Open Visualization.
- Select a camera in the Hierarchy or Scene view.
- Move the camera through the intended viewpoints.
- Watch renderers disappear when they leave the camera frustum or become occluded.
- Use the Scene view's Occlusion Culling popup to change the overlays.
Useful overlays include:
| Overlay | What it shows |
|---|---|
| Camera Volumes | Regions where Unity generated occlusion data and the cell containing the selected camera. |
| Visibility Lines | Green lines from the selected camera to elements considered visible. |
| Portals | Connections between cells in the occlusion data. |
If the camera is outside the generated Camera Volumes, Unity does not perform occlusion culling from that position.
Add an Occlusion Area for View Volumes
An Occlusion Area can define where a camera is expected to move. Unity generates higher-precision data inside these view volumes.
Without explicit view volumes, Unity creates one that contains the scene geometry marked as Static Occluder or Static Occludee. In a large or complex scene, that can produce unnecessary data and longer baking.
To define a camera region:
- Create an empty GameObject.
- Add an Occlusion Area component.
- Set Center and Size to cover an area where a camera can travel.
- Enable Is View Volume.
- Add other areas for disconnected camera regions when required.
- Bake again.
- Confirm the yellow Camera Volumes cover every valid camera position.
The component has no effect as a view volume unless Is View Volume is enabled.
Dynamic GameObjects
Unity cannot bake dynamic GameObjects as Static Occluders or Static Occludees. A dynamic renderer can still be culled behind baked static occluders when its Renderer component has Dynamic Occlusion enabled.
Unity documents Dynamic Occlusion as enabled by default.
Dynamic objects:
- Cannot contribute blocking geometry to the bake.
- Can be hidden by baked static occluders at runtime.
- Must keep Dynamic Occlusion enabled to participate as dynamic occludees.
Disable Dynamic Occlusion only when a specific rendering effect requires an object to remain visible through occluding geometry or when the object should deliberately skip that runtime calculation.
Verify the Bake
Test each important camera route:
- Stand directly beside walls.
- Look through doorways, windows, and narrow openings.
- Approach corners from both directions.
- Check stairs, balconies, raised platforms, and lower floors.
- Test teleport destinations and any remote camera positions.
- Confirm renderers disappear only after they are fully blocked.
- Confirm the camera remains inside the baked Camera Volumes.
Record the bake parameters before changing them. After each rebake, compare the same camera positions.
Troubleshooting
Hidden objects remain visible in the Visualization view.
Unity's culling data is conservative. Confirm the blocking geometry is an eligible Static Occluder, then reduce Smallest Occluder if the blocker is smaller than the current setting. Lower values increase bake detail and data size.
A visible object is incorrectly culled.
Reduce Smallest Hole so the bake preserves the relevant opening. Unity also recommends trying a Backface Threshold of 100 and removing Occluder Static from geometry that should not block visibility.
The bake is very slow.
Increase Smallest Hole to reduce the detail required for narrow openings. Also verify that explicit Occlusion Areas cover only camera-accessible regions in a large scene.
The occlusion data is too large.
Increase Smallest Occluder so smaller blockers are excluded, review the Backface Threshold, and restrict high-precision camera regions with appropriate Occlusion Areas.
The bake fails with “Failure in split phase.”
Unity documents this as a possible out-of-memory result when a large scene produces too many computation tiles. Increase Smallest Occluder and divide the scene into smaller sections.
Moving objects are never occluded.
Select the object's Renderer and confirm Dynamic Occlusion is enabled. Dynamic objects cannot be baked as occluders, but enabled renderers can be culled behind baked static occluders.
Visualization stops working in part of the scene.
Enable the Camera Volumes overlay and check whether the selected camera is outside the yellow volume. Resize or add an Occlusion Area with Is View Volume enabled, then rebake.
Continue Learning
- Set Up LOD Groups in Unity 2022.3
- Unity Performance Basics for VRChat Worlds
- World Optimization Checklist
- ProBuilder Blockout Workflow for VR Worlds
Official References
- Unity 2022.3 Manual: Getting started with occlusion culling
- Unity 2022.3 Manual: The Occlusion Culling window
- Unity 2022.3 Manual: Dynamic GameObjects and occlusion culling
- Unity 2022.3 Manual: Occlusion Area
- Unity Manual: Troubleshooting occlusion culling
Next Step
Compare visibility and geometry controls with Set Up LOD Groups in Unity 2022.3.