# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flora.magneticarcade.com/scripts/density-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
