Again Determinism

Post Reply
Drager
Posts: 8
Joined: Tue Sep 21, 2010 4:49 pm

Again Determinism

Post by Drager »

Hello,

I read all posts in the forum about determinism and how to achive it.
But I dont get it working. This is what I do:

I save the current transformation state by getting getWorldTransform() from all btRigidbodys.
(Note: I ensured that there is no force / velocity on any object).

Then I run the simulation.

After this I do the following steps:

- Remove all objects from dynamicWorld.
- Delete and recreated all elements of bullet:
btSoftRigidDynamicsWorld
btAxisSweep3
btGhostPairCallback
btDefaultCollisionConfiguration
btCollisionDispatcher
btSequentialImpulseConstraintSolver

- Reset btRigidbodys state:
setAngularVelocity(btVector3(0,0,0));
setLinearVelocity(btVector3(0,0,0));
clearForces();
forceActivationState(ACTIVE_TAG);
setDeactivationTime(0);
setWorldTransform with the transformation saved before

- Then I readd all rigidbodies to dynamic world and rerun the simulation.

I always get different results, additionally I checked that the following is implemented / done correctly:
- fixed time steps
- framerate independent
- btAxisSweep3::resetPool()
- btSequentialImpulseConstraintSolver::reset()
- assure that the elements are added in the same order.

Is there anything I missed?

Thanks in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Again Determinism

Post by Erwin Coumans »

Just re-create everything from scratch, including the rigid bodies (there is some state kept internally too).
And make sure to insert the data in exactly the same order to the world.

I just fixed the open source Maya Dynamica plugin to be deterministic, by re-creating all data, and it works fine.

Note that re-creating all data from scratch is necessary for Bullet 2.x, but for Bullet 3.x I'll make sure it will not be necessary.
Thanks,
Erwin
Drager
Posts: 8
Joined: Tue Sep 21, 2010 4:49 pm

Re: Again Determinism

Post by Drager »

Hello Erwin,

Thanks for your answer!

I finally got it working, additionally to your suggestion I had to change another thing.

I was setting the saved btTransform in the btRigidBodyConstructionInfo via btDefaultMotionState, when construction the rigidbody.
This did not work!

If I construct btDefaultMotionState with standard constructor and after this I set the btTransform with
btRigidBody::setWorldTransform it works.

I don't know whats the difference between these two methods,
I only had a short look at the btRigidbody Constructor and it seems it does a lot of this with the Transformation...

Thanks for your help

Michael
Toadcop
Posts: 11
Joined: Mon Feb 22, 2010 10:13 pm

Re: Again Determinism

Post by Toadcop »

but for Bullet 3.x I'll make sure it will not be necessary.
some info on possible "released date' ? or how is the development progress ?
3.X promises to bring some new essential features.
Drager
Posts: 8
Joined: Tue Sep 21, 2010 4:49 pm

Re: Again Determinism

Post by Drager »

Another question:

Now I got determinism with the already added objects,
as soon as I add another object, I get a different simulation result, also if the new object doesn't interact with the already added elements.

E.g. I add an element which doesn't interact with the objects at the beginning but it will interact after some time.
So I would expect, that the simulation runs deterministic until the new element interacts with the already added objects.

This is obviously not the case.
So is there a chance to get the simulation more deterministic also when adding objects?

I also noticed that very small (0.001) changes in the object origin, results in completly different results.
Can I achieve better results, when scaling the whole world?

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

Re: Again Determinism

Post by Erwin Coumans »

So I would expect, that the simulation runs deterministic until the new element interacts with the already added objects.
Unfortunately it is not that simple.

Any change in the world, including adding a non-interacting objects, can cause the simulation to diverge. It goes beyond the scope of this quick answer to digg very deep, but one example would be that the broadphase acceleration structures will be different. This can cause a difference in the order of overlapping objects, which in turn will lead in a different constraint ordering. This will lead to different results.

Thanks,
Erwin
Drager
Posts: 8
Joined: Tue Sep 21, 2010 4:49 pm

Re: Again Determinism

Post by Drager »

Erwin Coumans wrote: Unfortunately it is not that simple.

Any change in the world, including adding a non-interacting objects, can cause the simulation to diverge. It goes beyond the scope of this quick answer to digg very deep, but one example would be that the broadphase acceleration structures will be different. This can cause a difference in the order of overlapping objects, which in turn will lead in a different constraint ordering. This will lead to different results.
Ok I see.
Is there some keyword for this problem?
so I can search to get a deeper understanding for this.

I also tried to add the objects at the beginning and then moving it, but also this will destroy determinsm.
(also if the objects never interact with the other objects).

Is there any chance to reduce this effect somehow?

Thanks.
robb
Posts: 3
Joined: Wed Jul 16, 2014 9:16 am

Re: Again Determinism

Post by robb »

Hi, I am facing a related issue, although I wouldn't call it a 'determinism' issue.

If anyone figured out anything useful or could throw some light at my problem that'd be really great, thanks!

Here's the other thread:
http://bulletphysics.org/Bullet/phpBB3/ ... =9&t=10015

Cheers
Post Reply