6000 static objects: best strategy ?

Post Reply
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

6000 static objects: best strategy ?

Post 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
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: 6000 static objects: best strategy ?

Post 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.
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: 6000 static objects: best strategy ?

Post 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 !
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: 6000 static objects: best strategy ?

Post 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 ?
User avatar
KKlouzal
Posts: 65
Joined: Thu Mar 06, 2014 5:56 am
Location: USA - Arizona

Re: 6000 static objects: best strategy ?

Post 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.
Post Reply