Page 1 of 1

Simulation determinism, Parallel processing.

Posted: Sun Mar 18, 2007 1:26 pm
by Remotion
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! :)

Re: Simulation determinism, Parallel processing.

Posted: Sun Mar 18, 2007 8:17 pm
by Erwin Coumans
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

Posted: Sun Mar 18, 2007 8:48 pm
by Remotion
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?