Table of Contents

Culling


BRG Instanced Renderer uses a multi-level GPU-driven culling pipeline to ensure only visible instances consume rendering resources. All culling runs entirely on the GPU via compute shaders, keeping CPU overhead near zero regardless of instance count.

Seven types of culling work together in a hierarchical pipeline:

Frustum Culling

Instances outside the camera's field of view are excluded. Tested at both the chunk level and per-instance level for maximum efficiency.

Frustum Culling

3-Stage Occlusion Culling

Occlusion culling runs across three stages, progressively narrowing down what needs to be drawn:

  1. CPU Occlusion (Baked) — Chunks are tested against Unity's baked occlusion data on the CPU before any GPU work begins. Entire chunks hidden behind static occluders are discarded immediately. Enable via Use Baked Occlusion Culling on the Config.

  2. GPU Chunk Occlusion (HZB) — Surviving chunks are tested on the GPU against a Hierarchical Z-Buffer (depth pyramid) built from the previous frame's depth buffer. This catches chunks hidden behind dynamic geometry that baked data cannot account for.

  3. GPU Per-Instance Occlusion (HZB) — Individual instances within visible chunks are tested against the same HZB, culling instances hidden behind other objects even when their chunk is partially visible.

The HZB depth pyramid is constructed each frame using a compute shader based on AMD FidelityFX Single Pass Downsampler (SPD) for the fastest possible performance, and pixel expansion compensates for camera movement between frames. Controlled by Use GPU Occlusion Culling on the Config, which is on by default.

An optional HZB Retest Pass adds a second phase: once the current frame's depth is available, instances that were occluded in the first pass are re-tested against the fresh depth buffer, and the ones that turn out to be visible are drawn in a recovery pass. This recovers instances that were falsely occluded due to camera movement, reducing temporal artifacts. Shadow casters are recovered along with camera-visible instances, so a falsely occluded caster doesn't lose its shadow for the frame. Enable via Use HZB Retest Pass on the Config.

URP supports the retest pass directly. In HDRP, the depth prepass hook needed to drive it is added automatically when your scripts compile — there is nothing to install, and the HDRP package is left untouched. Tools > BRG Instanced Renderer > HDRP > Check Status reports whether the hook is available, and Recompile Depth Prepass Hook forces a clean recompile if it isn't.

Important

Upgrading from before 1.6? Earlier versions required embedding the HDRP package and applying a manual depth prepass patch through Tools > BRG Instanced Renderer > HDRP > Apply Depth Prepass Patch. That step is gone, and the menu item no longer exists.

If your project still has the old patch, BRG Instanced Renderer detects it and logs an error asking you to un-embed HDRP. Do this to revert it:

  1. Close Unity.
  2. Move Packages/com.unity.render-pipelines.high-definition out of the project to keep a backup.
  3. Leave HDRP's version entry in Packages/manifest.json and reopen Unity. Package Manager restores the original package and recompiles.
  4. Un-embedding also removes any other assets' HDRP patches — reapply those afterwards, re-embedding HDRP if those assets require it.

Sharing Unity's Depth Pyramid

When Unity's GPU Resident Drawer is active with instance occlusion culling enabled, BRG Instanced Renderer reuses the occluder depth pyramid the GPU Resident Drawer already built for that camera instead of building a second one. This happens automatically — there is no setting — and it removes the HZB build cost entirely for that frame.

The pyramid is only shared when it's an exact match for what BRG Instanced Renderer needs: a game camera, a reversed-Z depth buffer, no MSAA, and matching dimensions. URP additionally excludes dynamic scaling and XR; HDRP requires that the depth prepass actually supplies the occluders, which means either a forward lit shader mode, Depth Prepass With Deferred Rendering enabled in Frame Settings, or Use Depth Prepass For Occluders enabled in the HDRP asset's GPU Resident Drawer settings. When any condition isn't met, the HZB is built normally and nothing else changes.

Occlusion Culling

Distance Culling

Instances beyond a configurable distance are not rendered. Set per-group via BRG GameObject Group or per-terrain via BRG Terrain Registerer.

Screen-Size Culling

Instances too small on screen are culled automatically, with optional fade-out. Configured per-prefab via BRG Prototype Extra Data / LOD Overrides.

Dynamic Density Culling

Gradually thins out instances at distance using a deterministic hash. Instances can be crossfaded in and out for smooth transitions. It helps as both a performance optimization, as well as a way to help make detail render distance blend more naturally. See Dynamic Density for details.

Dynamic Density Culling

Shadow Culling

Shadow rendering has its own dedicated culling pass, with per-cascade frustum testing and per-prototype cascade limits. See Shadow Optimization for details.

Shadow Caster Occlusion — Lossless (HZB)

Shadow casters whose entire swept shadow volume is hidden behind the previous frame's depth are skipped on the GPU. For example, a tree behind a tall mountain doesn't need to render shadows if its shadow can't possibly reach a visible surface. This dramatically reduces shadow pass cost in scenes with large occluders.

  • Directional lights only. Point and spot light shadow casters are not tested.
  • Requires Use GPU Occlusion Culling (the HZB pipeline must already be running).
  • Tested against the owning camera's previous-frame HZB.
  • Enable via Shadow Caster Occlusion on the Config. On by default.
  • HZB Shadow Segments controls how finely a long shadow volume is split for testing — more segments cull more, at one extra depth sample each.
  • Worst-case artifact: a shadow can reappear one frame late after a fast disocclusion (e.g. when a camera whips around a corner). At normal framerates this is imperceptible, and enabling the retest pass does not remove it.
Lossy Shadow Culling (per group)

For prototypes that cast short shadows — grass, small props, debris — three cheaper but lossy modes are available per BRG Prototype Group. Each trades some shadow correctness for a much larger cut in shadow culling and rasterization work.

  • Lossy Shadow Frustum Culling — drops casters once their bounds leave the camera frustum (plus a configurable padding). Off-screen geometry stops casting into view, most noticeable at low sun angles and under fast camera rotation.
  • Lossy Shadow Occlusion Culling — extends the lossless test above by also checking the caster's own bounds against the depth pyramid, instead of only its swept shadow volume. A caster hidden behind an occluder stops casting even when its shadow would still land somewhere visible. A bounds size multiplier inflates the tested bounds to trade culling for fewer false culls. Requires Shadow Caster Occlusion.
  • Shadow Caster Distance Culling — stops casters contributing shadows past a distance from the camera. Can follow the pipeline's own shadow distance automatically, or use an explicit per-group value.

Because each can remove shadows you would otherwise see, apply them to groups where the shadow contribution is small — not to large hero geometry.

For culling settings, see BRG Instanced Renderer Config and BRG Prototype Extra Data / Density.

Tip

Culling can be viewed in scene view by ticking Debug Visualize Culling In Scene View in your Config file!