Using Bullet for collision in ParticleSystem

Alundra
Posts: 14
Joined: Sat Aug 13, 2011 3:25 pm

Using Bullet for collision in ParticleSystem

Post by Alundra »

Hi,
currently working on a particle system, i would use bullet to manage collision.
What is the best solution to do this ?
Is-it correct to use box shape for each particle ?

Thanks
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Using Bullet for collision in ParticleSystem

Post by dumbo2007 »

How many particles do you plan to have ? I dont remember seeing any particle simulation demos with Bullet(there may be some though, not sure). Maybe you can try with a large number of small boxes and if you experience slow downs then you can try the new multithreaded support.

I think a better way maybe to not load all the particles into Bullet as a very large number of rigid bodes may cause a slow down. If we take the case of smoke around a larger body say a large cube, then maybe you can start with calculating the positions of the particles yourself and translating them in every step. If any particles enter the bigger body's AABB then load it as a small rigid body(sphere/box). Initialize the body with its current velocity(setting orientation may not be so important). From that point on let bullet calculate the position as the particle will probably collide with the larger body and set the particle's position from Bullet. If the particle moves out of the AABB remove it from the sim.

You can also deactivate objects. With careful control of the number of objects in the simulation you may be able to support a large number of particles which will probably lead to more realistic looking smoke(an example)

Correction, there is a ParticlesOpenCL demo.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Using Bullet for collision in ParticleSystem

Post by dphil »

Yeah I think you'd want to check out systems specialized for particle systems (like the OpenCL demo). Loading/unloading rigid bodies based on aabb overlap might not be an efficient approach depending on how dense your particle system is (in a sufficiently dense system you could have frequent loading/unloading per particle; alternatively, at very high densities, you might as well just keep the rigid bodies there the entire time).

I saw a reasonably impressive demonstration (and discussion) last year of a master's project that used the blender game engine (bullet physics) with OpenCL to produce a smoothed particle hydrodynamics simulation with thousands of particles (spheres; picture a box with thousands of balls "sloshing" around) in real time on a medium-high-end desktop computer. I don't recall the link, unfortunately.