Simulation determinism, Parallel processing.

Post Reply
Remotion
Posts: 22
Joined: Sat Sep 24, 2005 10:01 pm

Simulation determinism, Parallel processing.

Post by Remotion » Sun Mar 18, 2007 1:26 pm

Hello,

I am experimenting now with Bullet and have some question about it.

For my purpose the real-time is not as important as visual quality.
How to improve quality of the bullet's simulation?

I am also not quite sure how to increase Sub Steps with stepSimulation...

Code: Select all

stepSimulation(stepTime, 1, 1.0f/60.0f)
Another question is how to arrive deterministic simulation with Bullet?
So the two runs of the same simulation on the same system will get the same results.

Probably the first problem is the btRand2() from equentialImpulseConstraintSolver and static seed...

And the last question, how to use Bullet on Multi Core CPU's?
As I know there was some work for Parallel processing for Bullet, is this correct?

I am also working on Window 32-bit, 64-bit and Intel,PPC MacOSX, fortunately Bullet is pretty portable.

Thank you in advance for any help and also for this Library! :)

User avatar
Erwin Coumans
Site Admin
Posts: 4223
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Simulation determinism, Parallel processing.

Post by Erwin Coumans » Sun Mar 18, 2007 8:17 pm

Remotion wrote:Hello,

I am experimenting now with Bullet and have some question about it.

For my purpose the real-time is not as important as visual quality.
How to improve quality of the bullet's simulation?

I am also not quite sure how to increase Sub Steps with stepSimulation...
You can decrease the inner timestep to improve accuracy in collision handling. If you pass the real timestep, then make sure maxNumSubSteps is large enough so that stepTime < maxNumSubSteps * internalTimeStep. Otherwise the simulation will drop frames. So you can increase maxNumSubSteps to a very large value. Alternatively just pass '0' to maxNumSubSteps and pass a very small stepTime.

Following 2 examples show a higher accuracy:

Code: Select all

btScalar internalTimeStep = 1.0f/240.0f;
stepSimulation(internalTimeStep, 0);
or alternatively:

Code: Select all

int maxNumSubSteps = 1000;
btScalar internalTimeStep = 1.0f/240.0f;
stepSimulation(stepTime, maxNumSubSteps, internalTimeStep)
Another question is how to arrive deterministic simulation with Bullet?
So the two runs of the same simulation on the same system will get the same results.

Probably the first problem is the btRand2() from equentialImpulseConstraintSolver and static seed...
Yes, first step would be to re-initialize this seed when the simulation starts. I will add this to the todo.
And the last question, how to use Bullet on Multi Core CPU's?
As I know there was some work for Parallel processing for Bullet, is this correct?
Yes, there is an PS3 SPU optimized version that runs collision detection (and solver tasks) in parallel. Some of the changes roll back into the open source verison of Bullet which facilitates SIMD and multi-core optimizations. Some parts in this process are already visible: for example in Bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h, check the new overlapping pair array:

Code: Select all

btAlignedObjectArray<btBroadphasePair>  m_overlappingPairArray;
This btAlignedObjectArray replaces the stl::set, and can be easier processed in parallel by multi-core cpu's. You can expect to see some progress towards multi-core optimizations for Bullet.

Thanks,
Erwin

Remotion
Posts: 22
Joined: Sat Sep 24, 2005 10:01 pm

Post by Remotion » Sun Mar 18, 2007 8:48 pm

Thanks Erwin!

So now I have disabled SOLVER_RANDMIZE_ORDER so the btRand2 should newer used but unfortunately the result are all ways different.
What else can be disabled, reseted?

Post Reply