Rendering
Contains information about how Flora culls and renders instances.
Culling
Flora utilizes an efficient culling system to manage and render instances in your scene. The culling process involves several key components and steps:
Container Management: Flora organizes instances into InstancedMeshContainers. Each container manages instances that share the same prefab and contains a static bounding volume hierarchy (BVH) for child instances.
BVH Construction: The BVH is built in the background whenever the container is modified. This process occurs via a background job whenever instances are added, updated, or removed. The BVH accelerates culling and instance queries within the container.
Render Loop
BVH Culling: Flora uses the BVH to perform initial culling, reducing the cost of frustum and shadow culling.
Batching: After BVH culling, instances are sorted by render-state, material, and mesh. These batches are combined into draw groups that are submitted to the GPU.
GPU Culling: The GPU performs a finer-grained culling pass, considering distance, density, occlusion, and LOD level and transition. This phase builds the final draw commands for each draw pass.
GPU Occlusion: See the Occlusion page for more information.
Level of Detail (LOD)
Flora supports up to 8 levels of LOD, using a similar algorithm to Unity's LOD system with minor differences:
LOD Transitions: Flora's broader culling approach may cause subtle differences in transitions, but the overall effect should be negligible.
LOD Cross-Fading: Flora supports both animated and transition-based cross-fading:
Animated Cross-Fading: Transitions between LODs based on
LODGroup.crossFadeAnimationDuration
or theCrossFadeAnimatedDuration
property on the active camera with an InstancingCameraSettings component.Transition-Based Cross-Fading: Uses the
Fade Transition Width
property of theLODGroup
attached to the prototype. Ensure this property is correctly set to avoid issues during LOD transitions. Refer to the LODGroup documentation for more details.
Batching
Flora efficiently batches instances to optimize rendering performance:
Batch Optimization: Instances are sorted by mesh, material, and render state before being combined into batches for rendering.
Unified Batching: Although containers are culled separately, batching is unified across the scene.
GPU Streaming
Flora manages GPU memory dynamically to handle large-scale environments:
Dynamic Loading: Containers are only loaded into GPU memory when they are within rendering distance of a camera.
Automatic Unloading: If a container remains outside the rendering distance for more than 120 frames, it is automatically unloaded from the GPU, freeing up memory. This feature is particularly beneficial for scenes with dense, close-range details like grass.
Last updated