> For the complete documentation index, see [llms.txt](https://flora.magneticarcade.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flora.magneticarcade.com/scripts/density-settings.md).

# Density Settings

This volume component controls how Flora reduces instance density for performance or style.

## What This Affects

* Total visible instance counts
* Distant/small-on-screen instance reduction
* Per-layer and per-size density targeting

Attach this component to a [Volume](https://docs.unity3d.com/6000.1/Documentation/Manual/urp/Volumes.html) to enable density culling effects within specific regions.

***

### Properties

#### <mark style="color:yellow;">GlobalDensityMode</mark>

* Controls how global density applies:
  * `Disabled`
  * `RenderersOnly`
  * `RenderersAndLODGroups`

> Migration note: `GlobalDensityEnabled` is obsolete and maps to this mode.

***

#### <mark style="color:yellow;">GlobalDensityMask</mark>

* Selects which instance layers are affected by global density.

***

#### <mark style="color:yellow;">GlobalDensity</mark>

* Fraction of instances to keep.
  * `1.0` = keep all
  * `0.5` = keep half
  * `0.0` = keep none of matching instances

***

#### <mark style="color:yellow;">GlobalDensitySizeThreshold</mark>

* Objects larger than this diagonal size are exempt from global density culling.

***

#### <mark style="color:yellow;">RangeDensityMode</mark>

* Controls how range density applies:
  * `Disabled`
  * `RenderersOnly`
  * `RenderersAndLODGroups`

> Migration note: `RangeDensityEnabled` and `RangeDensityAffectsLODGroups` are obsolete and map to this mode.

***

#### <mark style="color:yellow;">RangeDensityMask</mark>

* Selects which layers are affected by range-based density.

***

#### <mark style="color:yellow;">RangeDensity</mark>

* Minimum density for small-on-screen instances.

***

#### <mark style="color:yellow;">RangeDensityFalloff</mark>

* Controls how quickly density falls from full to `RangeDensity`.

> Migration note: `RangeDensityFalloffPower` is obsolete and maps to this field.

***

#### <mark style="color:yellow;">RangeDensityScreenPercentage</mark>

* Screen-size thresholds used for range-based density.
* Lower bound is constrained by [`MinScreenSize`](/scripts/render-settings.md#minscreensize).

## Runtime Override Note

Set both mode and value with `Override(...)` when applying user settings at runtime:

```csharp
var sceneSettings = FloraSceneSettings.GetOrCreate();
var density = sceneSettings.GetGlobalDensitySettings();

density.GlobalDensityMode.Override(FloraDensityMode.RenderersOnly);
density.GlobalDensity.Override(0.75f);

density.RangeDensityMode.Override(FloraDensityMode.RenderersOnly);
density.RangeDensity.Override(0.6f);
```

## How To Verify

* Lower `GlobalDensity` and confirm broad thinning.
* Enable range density and confirm stronger thinning for distant/small-on-screen instances.
