Platforms and performance¶
Compute shaders and the CPU path¶
Grass is fastest with compute shaders: blades are placed and culled on the GPU and drawn with one indirect call per patch.
Where compute shaders are not available, such as WebGL 2, grass falls back to a CPU instancing path automatically. The CPU path culls on the main thread and draws in batches of 1,023 blades. It draws the same grass, but measured about 3x slower on a large scene. The Grass tab's header shows which path is running (GPU or CPU).
Preview the CPU path on desktop with Force CPU Instancing under PERFORMANCE > Diagnostics.
WebGL¶
- Plan smaller fields for the web, or a lower Density Scale. On the CPU path, blades skipped by Density Scale are dropped before any other test, so they cost almost nothing.
- A WebGL player has no threads, so building grass at scene load takes longer than on desktop.
- Scene ambient light is driven directly by the Skybox module, not re-rendered from the skybox probe, so WebGL builds light the same as the editor.
Mobile¶
Mobile is lightly tested. Fable runs the same two paths: the compute path where the device supports compute shaders, the CPU path otherwise. No device matrix has been tested yet. Start from a low Max Draw Distance, a lower Density Scale, and grass shadow casting off.
Limits¶
- Max Instances caps each patch's blade count.
- Up to 64 grass interactors per frame.
- A blade mesh draws its first submesh only.
- A spline surface's mesh is capped at about 200,000 vertices.
- The grass shader is lit by the main directional light (with its shadows and cookie), scene ambient and fog. Point and spot lights do not light it.
- Blade placement and facing are baked when grass builds. Moving a surface mesh, or turning the wind, needs a rebuild to update them.
- Enter Play Mode Options with Domain Reload disabled is supported. With both domain and scene reload off, grass keeps its build when you enter Play mode instead of building again.