Publisher | SmallBurger |
---|---|
File size | 49.97MB |
Number of files | 64 |
Latest version | 1 |
Latest release date | 2024-10-15 02:57:26 |
First release date | 2024-10-04 02:34:12 |
Supported Unity versions | 2018.4.2 or higher |
As SRP Batch technology has advanced, Unity's automatic instancing feature is often disabled, leading to performance degradation when rendering a large number of objects. While manual instancing (such as using Graphics.DrawMeshInstanced) offers better performance, it is typically limited to rendering large amounts of single-type objects and lacks support for full-scene optimization.
The unique advantage of InstanceCollector is its ability to optimize GPU instancing across the entire scene. It not only effectively collects instance objects but also leverages Unity's Job System for precise culling calculations, ensuring optimal rendering performance. If the culling is not accurate enough, the performance might even be worse than SRP Batch, highlighting the core strength of InstanceCollector's technology.
Additionally, through the InstanceDataExporter, you can export matrix data for the scene, significantly speeding up scene loading while maintaining the flexibility of dynamic instance collection and rendering.
Why Not Use DrawMeshInstancedIndirect?
Generally speaking, compared to DrawMeshInstanced, DrawMeshInstancedIndirect offers better performance because it gathers matrix data in the compute shader. However, the biggest issue arises when the object count is zero. Since the CPU cannot determine the number of objects, it still calls the rendering API, and it seems like additional data is being sent to the GPU. When there are many different types of objects, this may lead to a performance drop. Therefore, to handle instance collections for multiple object types, we choose to use DrawMeshInstanced along with culling via the job system.