Table of Contents

Debugging


BRG Instanced Renderer provides several debug tools to help diagnose rendering, culling, and performance issues.

Debug Flags

All debug flags are on the BRG Instanced Renderer Config asset.

Enable Debug Logging

Outputs verbose console messages for all major operations: prototype registration, chunk allocation, pool resizing, culling dispatches, and more. Useful for understanding what the system is doing step by step.

Debug Bypass Chunk Culling

Skips the chunk-level culling pass and processes all instances directly. Use this to verify whether a rendering issue is caused by incorrect chunk bounds or overly aggressive chunk culling.

Debug Disable Culling

Skips the GPU culling pass entirely and reuses the previous frame's visibility results. This isolates the cost of culling in the profiler — if performance improves significantly with culling disabled, the culling pass may need optimization (fewer, larger chunks).

Debug Disable Rendering

Runs the GPU culling pipeline as normal but skips the actual draw command submission. Use this to isolate rendering cost from culling cost in the profiler.

Debug Disable Crossfade

Forces all LOD transitions to be instant, bypassing animated crossfade. Useful for verifying whether a visual artifact is related to the crossfade system.

Debug Visualize Culling In Scene View

Freezes the culling frustum to the Game camera's view. You can then orbit freely in the Scene View to see exactly which instances are being culled and which are visible. Instances outside the Game camera's frustum will not be rendered, making it easy to verify frustum culling behavior.

Profiler Markers

In Development builds, the following profiler markers are available in Unity's Profiler window:

Marker Description
BRGIR.CameraCulling Time spent dispatching GPU culling for the main camera
BRGIR.ShadowCulling Time spent dispatching GPU culling for shadow cascades
BRGIR.PostLateUpdate Per-frame maintenance: flushing staged uploads, settling motion vectors
BRGIR.WriteChunk Time spent writing instance data to a chunk
BRGIR.FreeChunk Time spent releasing a chunk and its pools
BRGIR.ResizePoolBuffer Time spent growing the pool buffer (indicates runtime growth)
BRGIR.AllocateChunk Time spent allocating a new chunk slot

Common Issues

Instances not appearing

  1. Verify the Config asset is in Preloaded Assets (Edit > Project Settings > Player)
  2. Check that only one Config exists in Preloaded Assets
  3. Ensure the prefab has a valid Mesh Renderer and Mesh Filter (or LOD Group)
  4. If using BRG GameObject Group, confirm it shows as converted in the inspector
  5. Try enabling Debug Bypass Chunk Culling to rule out culling issues

Instances flickering or popping

  • Check if LOD crossfade is set to No Crossfade — switching to Crossfade or Animated Crossfade smooths transitions
  • If using dynamic density, verify the Density Fade Width is not too small
  • Ensure LOD Bias is reasonable (very low values cause aggressive LOD switching)

High GPU memory usage

  • Lower Max Pools Per Chunk to reduce per-chunk allocation (each pool holds 64 instances)
  • Review the memory estimate in the System Window
  • If Support Legacy Light Probes is enabled, consider whether it's needed — it adds ~65% per-instance buffer cost (128 bytes/instance)

Shadow artifacts

  • Verify Max Shadow Cascade is appropriate per-prototype
  • Check that Min Shadow LOD isn't set too high (causing low-poly shadow silhouettes)
  • If shadow cascade seams are visible, increase Max Shadow Crossfade Cascade on the Config or per-prototype

Performance issues

  • Open the System Window to check draw command counts and utilization
  • Use Debug Disable Culling and Debug Disable Rendering to isolate CPU vs GPU cost
  • Check for BRGIR.ResizePoolBuffer profiler markers — frequent resizes indicate initial allocations are too small
  • Consider enabling Gathered Allocations to auto-size initial buffers from peak values