If I'm doing instanced rendering and need to send one mat4 per instance to the vertex shader, which approach is likely to be faster for large numbers of instances?
Based on comments/answers from robinjam, GuyRT and Brett Hale I did some testing. The test rendered 40000 instances of the same mesh (a triangle) updating each instance's model matrix every frame. My GPU is a GeForce GTX 460 SE.
Here are my results:
mat4 uniforms (updated via glUniformMatrix4fv) with 254 instances per draw call (limited due to uniform limits) = 160 fps
mat4 uniforms in a block (updated via a UBO) with 254 instances per draw call (limited due to uniform limits) = 260 fps
mat4 attributes (updated via a VBO) with 40000 instances per draw call = 287 fps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With