menu_bookDocumentation
Clutter System — scattering grass, rocks, and debris with GPU instancing
Clutter System — Scattering Grass, Rocks, and Debris
The Clutter System scatters large amounts of small objects (grass, rocks, debris) across a scene using GPU-instanced rendering. It handles placement, streaming, and LOD automatically.
Setup
- Create a Clutter Definition asset: Asset Browser → Create > Clutter Definition
- Add a ClutterComponent to a GameObject in your scene
- Assign the Clutter Definition to the component
Clutter Definition
The definition asset controls what gets scattered and how.
Entries
A list of models or prefabs to scatter. Each entry has a Weight controlling relative spawn probability. Use models for static props (grass, rocks), prefabs when you need components or behaviours.
Scatterer Types
| Scatterer | Description |
|---|---|
| Simple | Random placement with density, scale range, ground alignment, and height offset |
| Slope | Filters by surface angle — e.g. grass on flat ground, rocks on steep slopes |
| Terrain Material | Places entries based on the terrain material at each point |
Streaming Settings
- Tile Size — Size of each generation tile (256–4096 units). Larger = fewer jobs, coarser streaming.
- Tile Radius — How many tiles around the camera to keep populated (1–10).
ClutterComponent Modes
CSHARP
// Infinite mode — streams tiles around the camera automatically
var clutter = go.Components.Create<ClutterComponent>();
clutter.ClutterDefinition = myDefinition;
clutter.Mode = ClutterComponent.GenerationMode.Infinite;
// Volume mode — generates within a fixed bounding box, saved with scene
clutter.Mode = ClutterComponent.GenerationMode.Volume;
// Then click Generate in the inspector, or call:
clutter.Generate();Clutter Tool (Editor)
The Clutter Tool in the editor toolbar lets you paint and erase instances by hand:
- Paint — Left-click to scatter at brush location
- Erase — Ctrl+click to remove within brush radius
- Opacity — Controls density of painted placement (thins out for natural look)
Performance Notes
- GPU instancing means thousands of instances have minimal draw call cost.
- Keep TileRadius low (2–3) for large open worlds.
- Use models (not prefabs) for pure static props — prefabs have component overhead.
Was this helpful?