- Home /
how to render 60k cubes as efficiently as possible?
Hello, i would like to render a large number of cubes efficiently. the user will also be interacting with the cubes on every frame, so i will be storing my cubes on a mesh and modifying the cube's alpha and color every frame.
i would like to minimize the number of vertices, but i see unity no longer supports triangle strips (8 vertices per cube) so i am limited to triangles (24 vertices per cube), which will presumably perform 3x worse.
does anyone know a fast way to render and interact with a large number of cubes (60k+)? also while i'm here doe anyone know why unity removed triangle strips?
thanks,
Answer by MichaI · Jan 19, 2019 at 08:35 PM
If you haven't yet, you can enable GPU Instancing on your cube shader.
You could also make geometry shader for that but that's bit harder, require directx 11 and I'm not sure if it would much increase performance in your case.
In future ECS could be good solution for this, but from what I know it doesn't support physics yet. I found some work in progres ECS physics projects so if you not scared of ECS workflow you can try that ;) .
About that 8 vertices per cube, I'm not sure but I think that it may be because vertex cannot have multiple normals, so hard shaded edges wouldn't be possible, but if you doesn't need proper shading (for example you using unlit shader) it's possible to create cube with only 8 vertices.