Page cover

Culling Pipeline

An overview of each available culling pipeline used in Flora.

Flora supports two culling pipelines to accommodate different project needs. Each has its own performance profile, memory characteristics, and trade-offs.

To change the default pipeline project-wide, go to Edit → Project Settings → Graphics and update the default.


Batch Renderer Group

The new default pipeline for Flora, driven by Unity’s BatchRendererGroup (BRG).

You can enable it per scene via the SceneSettings component:

Batch Renderer Group settings

See also: FloraGraphicsSettings


Setup

BRG-compatible shaders generally work out of the box, but you must take steps to prevent Unity from stripping required variants in builds:

  1. Keep BRG shader variants

    • Edit → Project Settings → Graphics

    • Set BatchRendererGroup variants to Keep all

  2. If using URP, disable variant stripping:

    • Edit → Project Settings → URP Global Settings

    • Disable Strip Unused Variants

  3. Allow unsafe code

    • Enable Allow ‘unsafe’ Code in Player Settings

See Unity’s BRG Getting Started Guide for more info.


Performance

BRG significantly reduces CPU overhead by minimizing state change overhead.

  • Particularly beneficial in scenes with many unique instance types

  • May provide less benefit in scenes with only a few prefab types

  • However, BRG scales more efficiently as project complexity increases


Lights

A major benefit of BRG is per-light shadow culling:

  • The legacy pipeline only determines if an instance should be rendered in any shadow pass

  • BRG allows Flora to cull instances per light, improving performance in scenes with multiple shadow-casting lights


Memory

The legacy pipeline is slightly more memory-efficient:

Metric
Legacy Pipeline
BRG

Per-instance size

48 bytes

96 bytes

With motion vectors

96 bytes

192 bytes

  • BRG requires inverse matrices stored in the instance buffer

  • The legacy pipeline reconstructs the inverse matrices in-shader, saving memory but increasing ALU instructions


Shader Compatibility

BRG supports a wide range of shaders without modification, including:

  • Built-in URP and HDRP shaders

  • ShaderGraph shaders

  • Third-party shaders that support DOTS Instancing (Amplify Shader Editor)


Known Limitations

Child LOD Renderer Transforms

Child renderers under an LODGroup with non-identity transforms do not render using their local transforms in BRG mode.

To resolve this:

  • Bake child transforms directly into the mesh. A convienient way to do this from Unity is through FBX Exporter package.

This is due to Flora treating the entire LODGroup as a single instance, whereas Unity’s default behavior treats each child renderer as separate.

Current DOTS matrix limitations prevent overriding this behavior.


Render Mesh

The legacy pipeline uses Unity’s RenderMeshIndirect API.

Requirements

To use this pipeline, shader passes must include:

  • #include "Packages/ma.com.flora/ShaderLibrary/Instancing.hlsl"

  • #pragma multi_compile_instancing

  • #pragma instancing_options procedural:SetupFloraInstancingData

Additionally, materials must have GPU Instancing enabled.

Features

  • Compatible with Flora’s runtime debug shaders

  • Supports LODGroups with child renderers that use custom local transformations

Last updated