glue/fracture determinism

Post Reply
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

glue/fracture determinism

Post by majestik666 »

In our current implementation of bullet I've implemented glue
in a pretty similiar way as the new fractureDemo from the trunk,
but I really struggle to get a stable determinism for the simulations.

I have full determinism as long as I do not use glue object but when
I do the determinism seems to be a bit random, the solver setup
contains the resetPool, reset constraint solver, remove/add all objects
but that doesn't seem to fix it.

I've done a fair bit of debugging on it and I can't quite figure out where
the problem can be.
The current add/remove or rigid bodies is something like this :

* add all objects
* add objects splitted from the glue object
* remove all object

I haven't spent much time on the fractureDemo to test the determinism
but it's a bit tricky without a UI like maya :)

Has anyone got experience with this kind of issue ?

Thanks !
Francois
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: glue/fracture determinism

Post by majestik666 »

I played a bit with the fractureDemo, am not sure if the
fracture itself is supposed to be deterministic but I made
a simple modification to it and I get different sims every time
I launch the demo ...

To test, just add this code before the renderme() call in
FractureDemo::clientMoveAndDisplay() and watch it play
everytime you lauinch it , the sim will be different

if (sFrameNumber == 100)
sFracturingMode = true;
if (sFrameNumber % 200 == 0 && sFrameNumber > 0)
shootBox(btVector3(10,10,10));
sFrameNumber++;
almatea
Posts: 29
Joined: Mon Nov 02, 2009 10:15 am

Re: glue/fracture determinism

Post by almatea »

I have determinism with myself realization of glue after full reset of scene.
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: glue/fracture determinism

Post by majestik666 »

could you tell me what kind of
reset your doing ?
ie what are you resetting and when ?

would be very interested to know if i'm doing anything different ...
almatea
Posts: 29
Joined: Mon Nov 02, 2009 10:15 am

Re: glue/fracture determinism

Post by almatea »

majestik666 wrote:could you tell me what kind of
reset your doing ?
ie what are you resetting and when ?

would be very interested to know if i'm doing anything different ...

delete m_dynamicsWorld, m_solver, m_broadphase, m_dispatcher, m_collisionConfiguration, all objecst and theirs collision shapes
after this step and recreate my scene have same state
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: glue/fracture determinism

Post by majestik666 »

hmmm I was really trying to avoid going that far ...

I think bullet should be able to be deterministic without deleting the entire world , etc ...
my sims are fully deterministic when not using the glue and I don't delete the world ...

Erwin if you read this, any take on this kind of issue ? do we HAVE to delete/recreate
everything when using a glue system ?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: glue/fracture determinism

Post by Erwin Coumans »

Not sure what is causing this, but there are a few reported issues that might be related:

http://code.google.com/p/bullet/issues/detail?id=188
http://code.google.com/p/bullet/issues/detail?id=350
http://code.google.com/p/bullet/issues/detail?id=483

You surely have to remove all objects, and re-add them in the same order to the world.
Can you give it a try, deleting all structures, in particular world and broadphase, or using a different broadphase, and see if that helps?
Thanks,
Erwin
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: glue/fracture determinism

Post by majestik666 »

after a LOT of testing/debugging/etc came out with some interesting conclusions...

started by looking further at the determinism of our plugin and realized that in some
circumstances (I just haven't figured out what triggers it), everything becomes very
un-deterministic , even with very simple objects (without glue , etc).

From there I started moving back in our code base to the point where I reached a major
change for us, moving everything from float to double ...
I just did a test on a scene, our plugin + bullet compiled as float IS deterministic
plugin + bullet compiled as double is NOT ....

Erwin, would you have any idea if there could be something in bullet that breaks
determinism when using doubles vs floats ??

am really not sure where to start looking for the problem now :)

Cheers !
Francois
almatea
Posts: 29
Joined: Mon Nov 02, 2009 10:15 am

Re: glue/fracture determinism

Post by almatea »

can you describe your test scene?
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: glue/fracture determinism

Post by majestik666 »

it's actually a very simple scene , which was quite surprising when I saw that it was not deterministic
(see attached image)
a sphere or radius 1, mass 100 at (0,15,0)
4 cubes 1 unit , mass 1, wide slightly penetrating
1 ground cube 20x5x20 (passive)

this will lead to very different results everytime in double
but perfectly consistant in float ...

All build using convex hulls, I also tried with primitives (cubes + sphere)
but exact same results...)
Attachments
det.jpg
det.jpg (21.52 KiB) Viewed 7678 times
Post Reply