Simulation with a lot of objects

Post Reply
TheIgors
Posts: 2
Joined: Mon Jul 27, 2015 11:33 am

Simulation with a lot of objects

Post by TheIgors »

Hi All

What is a best way(s) to handle scenes with a lot (100K and more) of objects? Like a rain, snowblind, falling sand etc. I realize such simulation can take a significant time, it's not a catastrophe. Clear that I need to use a simplest shapes (such as sphere, cube) and, most probably, disable self-collisions. But are there more things to make it faster and to reduce RAM using?

- is it a rational idea to convert slept dynamic bodies into a static mesh(es)?

- can I use a very simplified/primitive collision detection, for example just cast a ray along speed vector? If so how?

- other ways/secrets that I don't know?

Thx
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Simulation with a lot of objects

Post by drleviathan »

One thing you need to know is that the computation cost of adding one new object to the world goes up as the number of objects already in the world increases. It could be that the cost gets unacceptably large before you reach 100k -- you'll have to test it yourself. However knowing this you can expect it to be more efficient to combine as much of the static scene into one or a few objects (if possible) rather than loading it in many parts.

You can reduce RAM by sharing shapes: if you have many btRigidBody's that require a common shape then you it is possible to instantiate only one btShape for all of them, but if the bodies can be deleted/created on the fly then you'll may need to write some accounting code to manage all the pointer references.
Post Reply