Page 1 of 1

6000 static objects: best strategy ?

Posted: Mon Aug 25, 2014 3:21 pm
by gjaegy
Hi,

I have searched the forum trying to find some posts about that. There are quite a few, but I haven't been able to figure out what the best solution is.

Basically, I have had one single static mesh until now (all buildings). However, we now using instancing to allow to render a huge number of objects (street lights in our case).

I am not sure what would be the best strategy for that case, so any input/experience would be greatly welcome.

The options I can see are:

- merge all the instanced meshes into the existing static mesh.
- create a new static mesh for each instanced mesh
- create a compound object, and add each instanced as individual static mesh child

What would you think would be the faster option ?

thanks a lot.
Gregory

Re: 6000 static objects: best strategy ?

Posted: Mon Aug 25, 2014 3:30 pm
by Erwin Coumans
- merge all the instanced meshes into the existing static mesh
Merging all meshes into a single static mesh will most likely be the fastest option: the btBvhTriangleMeshShape uses a quantized cache-optimized AABB tree (btOptimizedBvh). The Dynamic AABB tree structure (btDbvt) used for the btCompoundShape and btDbvtBroadphase can deal with change in tree topology and this allows for fewer optimizations.

Re: 6000 static objects: best strategy ?

Posted: Tue Aug 26, 2014 7:11 am
by gjaegy
Excellent, this was my initial feeling.
This is a very helpful answer, it will let me spare quite a lot of time :) Thanks a lot !

Re: 6000 static objects: best strategy ?

Posted: Wed Aug 27, 2014 9:29 am
by gjaegy
Erwin,

I am a bit struggling with our internal architecture :)

What would be the difference, in term of performance, between having a single static mesh vs. having about 10 static meshes (one for all buildings, one for all street light instances of type A, one for all street light instances of type B, etc...) ?

Would that make a big difference ?

Re: 6000 static objects: best strategy ?

Posted: Wed Aug 27, 2014 11:06 am
by KKlouzal
1 draw call vs 10 draw calls is nothing in comparison to 6000 draw calls. You shouldn't notice any difference. It all does however eventually add up.

EDIT: and then it hit me like a ton of bricks, you're talking about bullet's performance. My previous statement should still be valid, better let someone more experienced comment on that though.