Table of Contents

Core Methods


Public methods on the BRGInstancedRenderer singleton for runtime control.

Access the singleton via BRGInstancedRenderer.Instance.

SetDensity

public void SetDensity(float density)

Set the global density scale (0–1). Prototypes with Enable Density Scaling enabled on their BRG Prototype Extra Data will thin out instances proportionally.

Parameter Type Description
density float Density multiplier, clamped to 0–1. 1 = full density, 0 = maximum culling.
// reduce density to 50% (e.g. as a graphics setting)
BRGInstancedRenderer.Instance.SetDensity(0.5f);

// restore full density
BRGInstancedRenderer.Instance.SetDensity(1f);

RuntimeRefresh

public void RuntimeRefresh()

A faster refresh path for use at runtime. Shuts down and re-initializes all active registerers, causing them to re-extract and re-upload their instance data. Use this after you have programmatically changed terrain data, swapped prefabs, or modified prototype settings at runtime.

BRGInstancedRenderer.Instance.RuntimeRefresh();

CompactBuffers

public void CompactBuffers()

Compacts the internal instance pool and chunk buffers to reduce GPU memory waste. Leaves approximately 25% headroom above current usage. This causes a small frame hitch, so call it during pauses, loading screens, or scene transitions rather than during gameplay.

// compact during a loading screen
BRGInstancedRenderer.Instance.CompactBuffers();

The Config also provides an Enable Auto Compaction option that runs compaction automatically when utilization is low, but manual compaction is recommended to prevent hitches.

SnapCrossfadeStates

public void SnapCrossfadeStates()

Snap all animated crossfade transitions to their target LOD immediately, skipping the fade animation. Call this after teleporting the camera or loading a new scene area to prevent a mass fade-in of all visible instances.

// after teleporting the player
player.transform.position = newPosition;
BRGInstancedRenderer.Instance.SnapCrossfadeStates();

SnapCrossfadeState

public bool SnapCrossfadeState(Camera camera)
public bool SnapCrossfadeState(int viewID)

Snap animated crossfade for a single camera or view. Returns false if the view has not been seen by the culling system yet.

The Camera overload is a convenience wrapper that passes camera.GetInstanceID() to the int overload.

Parameter Type Description
camera Camera The camera to snap crossfade for.
viewID int The view identifier (camera instance ID or shadow view ID).
Returns Description
bool true if the view was found and snapped, false if the view ID is unknown.
// snap crossfade for a specific camera after teleporting it
BRGInstancedRenderer.Instance.SnapCrossfadeState(myCamera);