# Terrain Provider

The **Terrain Provider** component connects a Unity `Terrain` object to the [FloraSystem](https://flora.magneticarcade.com/scripts/system), enabling Flora to take over **tree** and **detail mesh** rendering.

> This component is typically added automatically when the [SceneSettings](https://flora.magneticarcade.com/scripts/scene-settings) singleton is present and **Auto Register Terrains** is enabled.
>
> **Scope:** This page applies to Unity `Terrain` integration (terrain trees/details).\
> For non-Terrain workflows, use [Instance Container](https://flora.magneticarcade.com/scripts/instance-container) or [Instance Renderer](https://flora.magneticarcade.com/scripts/instance-renderer). See [Container Samples](https://flora.magneticarcade.com/samples/container-samples).

***

## Trees

Tree instances are **loaded** from the terrain when a camera, and its far plane, are within distance of the terrain’s [`treeDistance`](https://docs.unity3d.com/ScriptReference/Terrain-treeDistance.html) value.

<figure><img src="https://2882982566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyo4B7EVXffipTxnJzee6%2Fuploads%2Fgit-blob-329b162be5ed00955927741dacfcdec8b9234ce7%2Fterrain-tree-prototypes.webp?alt=media" alt="Terrain tree distance UI"><figcaption></figcaption></figure>

***

## Details

Detail instances (e.g. grass, rocks, debris) are loaded when a camera, and its far plane, are within the terrain’s [`detailObjectDistance`](https://docs.unity3d.com/ScriptReference/Terrain-detailObjectDistance.html) range.

* When a detail cell goes **out of range**, it is **unloaded after 3 seconds**
* This helps reduce **GPU memory usage** in large terrain scenes

> ⚠️ For large environments, keep **detailObjectDistance** at a reasonable level to avoid unnecessary memory usage.

Unlike Unity’s built-in rendering system, Flora **supports detail meshes with LODGroups**.

* If Flora is disabled, Unity will fall back to its built-in rendering
* However, only the **first LOD mesh** will be used in that fallback path

<figure><img src="https://2882982566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyo4B7EVXffipTxnJzee6%2Fuploads%2Fgit-blob-4434e29322c5e946caabe571da1f03aaea43fa3a%2Fterrain-detail-prototypes.webp?alt=media" alt="Detail mesh preview with LODs"><figcaption></figcaption></figure>
