Bullet + performances + bodies count


I try to create some animation using Text(geometry) and bullets.
I get performance problems when overpassing ~1000 objects.
My framerate goes down (GPU).
I would like to use bullets for the coherence of the movements when there are contacts between objects.
Any idea about how to push it a bit more ?
2-3000 objects should be enough for what I want to do.

Thank you


As far as I checked one letter (Arial) is about 70 primitives, without extrusion.

So 3000 objects will be quarter million poly (assuming you only use single letters). Which is not much by today standard, but you’ll need to do some form of batching, since you’ll easily end up draw call bound.

There’s several ways to do that, if you texture your text objects it’s gonna be a bit more complicated.

Easiest way I see is (dx11 version) :

  • Build a huge buffer containing all your letters vertices (you can use dx9 split then save as random csv file or anything you want), you’ll need a buffer with all vertices and a buffer with all indices, no need to increment as in 9 since you can do that later.
  • Build a second buffer to store offset/count (use integral for that), let’s say you have 3 letters:
    A : 50 vertices / 30 indices
    B : 60 vertices / 24 indices
    C : 30 vertices / 27 indices

Your table will look like (offset-index offset-count):
0 - 0 - 30
60 - 30 - 24
90 - 54 - 27


  • When you create an object in bullet store the offset/count in custom pin
  • When you get object details, sum the count and send that to a null drawer. Also retrieve the offset/count and send to another buffer. Then build the world matrices and also send to a buffer ;)
  • As you have SV_VertexID and index table you should be able to lookup indices then vertices id in your offset buffer, then do lookup in the big buffer.

Ok I’ll make you a demo patch for that since I’m sure that explanation is confusing. It’s the same concept as in instancing_incremental example in girlpower but bit more advanced ;)

DX9 Version:

  • Bug devvvvs to have PrimitiveCount hidden pin in Shader ;) (then I can explain technique, it’s quite similar but you use textures instead)

Also what type of shape you use in bullet to represent your objects? Some are more expensive than others.