[URP/HDRP] Choosing Optimal Instancing Strategies for High Instance Counts
Solution
Unity 2021.3.x - Unity 6.3.x
Published 10 days ago
Guidance is sought regarding Unity rendering techniques including SRP Batcher, GPU Resident Drawer, and BatchRendererGroup to determine optimal performance for specific object counts.
The SRP Batcher is utilized as the fundamental rendering optimization method. While efficient for diverse batches, specialized instancing techniques are required to offload CPU work when rendering numerous similar meshes. The manual Enable GPU Instancing setting is generally avoided as it can be slower than the SRP Batcher when MaterialPropertyBlock is used for custom properties per instance. In scenarios requiring high efficiency without manual buffer management, the GPU Resident Drawer is a superior alternative.
Manual direct instancing necessitates the upload of all instance-specific data to GPU memory before each draw call. Manual indirect instancing improves upon this by allowing upfront buffer provisioning, which enables data reuse across multiple frames. If explicit buffer management is being undertaken, directly driving the BatchRendererGroup API is the most performant approach.
Entities Graphics is integral for rendering objects within a DOTS workflow, benefiting from data already resident in GPU memory. The GPU Resident Drawer provides similar capabilities within the GameObject ecosystem by leveraging BatchRendererGroup internally. Selection of the instancing method is contingent on the project content and target platform.
Use SRP Batcher for collections of 10 to 100 GameObject instances.
2.
Utilize GPU Resident Drawer for 1,000 to 10,000 instances in Unity 6.
3.
Implement BatchRendererGroup directly for high-level control over memory and culling.
Additional Tips
Note that BatchRendererGroup may introduce a minor GPU overhead on certain mobile architectures. * Ensure that shaders are compatible with the BatchRendererGroup by using the required data fetching macros.
TL;DR
Optimize rendering efficiency by selecting between the SRP Batcher and BatchRendererGroup based on platform constraints and instance density.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.