Uranus GPU Instancer
Last updated
Last updated
A plug and play hardware instancing solution that can massively increase performance in any PlayCanvas project.
In a few words, to increase performance! Even though hardware is becoming more and more powerful, rendering a 3D scene with real time lighting and shadows is very taxing on today's portable and desktop devices.
Developers are required to optimize their 3D games and applications to improve performance. One of the main metrics that should be closely monitored is the number of draw calls used for rendering each frame.
PlayCanvas supports Batching that is a system to reduce draw calls. It's an easy to use system but it comes with some limitations that can be showstoppers for several kinds of applications:
Long generation times for static batching.
No control over individual objects after they are statically batched.
Dynamic batching has a maximum number of 1024 objects supported per draw call.
Dynamic batching has a runtime performance cost.
Hardware instancing is a GPU feature that can help reduce your draw calls while it comes with fewer limitations. While PlayCanvas supports hardware instancing as a rendering feature, implementing it on your own can be a complex and time consuming process.
Uranus GPU Instancer is a powerful and easy to use hardware instancing solution for your PlayCanvas projects.
Features:
Drag and drop to your project and instancing is automatically applied to all scene entities. No need for assigning groups manually per entity.
All instanced entities are fully dynamic. They can update their position, rotation and scale even per frame, together with other component properties (toggle shadows on/off, change material, update layers etc).
Easy to use Level of Details by appending a suffix to the entity name (LOD0, LOD1 etc).
Frustum culling for visibility checks per instance or per cell (group of instances) for better performance.
Easily exclude any layer or entity from instancing.
Use the powerful uranus-instancer-data.js
script to consume local JSON data to spawn thousands of objects without the cost of having regular PlayCanvas entities in scene.
The uranus-instancer.js
script will extend the regular PlayCanvas Layer class and intercept all mesh instances registered for rendering.
It will automatically group those mesh instances into the minimum required draw calls by creating special hardware instanced vertex buffers and submit those to the GPU. The original mesh instances will be disabled and kept in a separate list for reference.
On render time the instancer will run, if required, LOD and visibility tests against all active cameras and update each vertex buffer to include only the required instances.
The instancer will automatically skip any mesh instances that don't support hardware instancing (e.g. skinned models).