Trying to go above the 1023 instances (GPU Instancing) ?

Hello everyone,

I’m trying to make good use of GPU Instancing for a project, but I’m hitting a wall with the maximum instances count you can draw.

I’m on Unity 2022.3.16f1

Symptom : when I’m drawing instances, the 1024th instance seems to get drawn on top of the very first instance draw.

I have tried those 2 methods and was limited:

I’ve also looked around and found that people seem to use Graphics.DrawMeshInstancedIndirect to avoid this limitation. Thing is, Unity documentation says this one is deprecated/obsolete and RenderMeshIndirect should be used instead.

Am I using RenderMeshIndirect incorrectly ? If not, does someone know where this limitation comes from and why the old Graphics.DrawMeshInstancedIndirect is not subjected to it ?

What would be a solid solution to draw many mores meshes while still using the methods recommended by Unity’s documentation ?
I thought of using multiple instances of the same script (script responsible Graphics.RenderMeshIndirect). So each of them is responsible for drawing one 1023-instances block. But isn’t there any other way ?

For those interested, you should use Graphics.RenderMeshPrimitives :wink:

2 Likes