Bullet restitution question

Post Reply
TriplVing
Posts: 12
Joined: Wed Jul 29, 2009 4:13 pm

Bullet restitution question

Post by TriplVing »

Hi everyone,

I am currently doing a few small comparisons against the main engines (as you do) and have come across something quite unusual.

I'm assuming (hoping) that I am making a silly mistake, but for the life of me I can't see it, so hoped one of you might be able to.

I have a very simple scenario setup in all 3 engines, I have a sphere of radius 10 and density 1 suspended at a y value of 100. I then have a static plane at y position 0 and set Gravity to -9.81. In all engines friction and damping (linear and angular) is set to zero and both the sphere and plane have restitution coefficients of 0.5. I then simply simulate with 1/60th timesteps and am recording the results. "Penetration" width (or skin width as PhysX calls it) is also set to the same tiny amount in Bullet and PhysX (0.001), I can't find the option in ODE, though I believe it solves contacts slightly differently to PhysX and Bullet anyway.

I have found that PhysX and ODE effectively provide the same result, with minor differences due to very minor contact penetration differences. However i can't for the life of me get Bullet to behave in even a similar manner. The first return bounce sees the sphere reaching roughly 50% of the height that I see with PhysX and ODE and then of course it reaches rest nearly 50% faster. Up until the first bounce all 3 engines produce identical figures.

I'm utterly stumped as I have been through the way I have set things up over and over and (other than minor differences I can allow for due to differing penetration techniques) really can't see how the results from Bullet could be so very different.

i can post code if anybody wants me to, but it really is almost the simplest program you could produce with Bullet!

Any help or insight anyone can offer would be very much appreciated.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by Dirk Gregorius »

There are differences how the restitution of the shapes are combined. E.g. some engines just use the max, others use sqrt( e1 * e2 ), etc. I know that you can choose this somewhere in PhysX. In ODE and Bullet you maybe need to adjust the source.

HTH,
-Dirk
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by pico »

You can try to enable m_splitimpulse in the solver to seperate restitution from collision seperation
TriplVing
Posts: 12
Joined: Wed Jul 29, 2009 4:13 pm

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by TriplVing »

Hi guys,

Thanks to both of you, things are now looking more sensible.

Dirk: You're right, I had forgotten that you can modify the way that values are combined in PhysX, by default it (and I assume ODE given the similar results) uses an average value of the two materials restitution (same for friction by the by). However, looking through btManifoldresult in "calculateCombinedRestitution()" it would seem that Bullet defaults to the multiple. I changed that to an average and things got more sensible.

pico: I then changed to enable m_splitimpulse and the values produced by Bullet are far closer to both PhysX and ODE now. Though it still comes to rest more quickly, I am happier that the comparison is now fairer at least.

Here's a graph if you are interested

Image

Out of interest, why does separating restitution from collision response make such a difference? Without that final option Bullet lost energy far more quickly than the other two engines. Is this a stability hack of some kind?

Again, thanks for the help guys.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by Dirk Gregorius »

I can only guess. but I think this is some velocity threshold below which restitution is ignored. PhysX has something like this
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by Erwin Coumans »

Is this a stability hack of some kind?
Possibly it might be caused by a too aggresive mechanism that disables restitution for resting contacts (to increase stability).

You might want to increase m_restingContactRestitutionThreshold and see if this changes. See also http://bulletphysics.org/mediawiki-1.5. ... _threshold

Code: Select all

btContactSolverInfo& info = dynamicsWorld->getSolverInfo();
info.m_restingContactRestitutionThreshold = 1e30;
As Dirk mentions, split impulse is another option to try.
Thanks,
Erwin
TriplVing
Posts: 12
Joined: Wed Jul 29, 2009 4:13 pm

Re: Bullet Vs PhysX Vs ODE Restitution question

Post by TriplVing »

Sorry for the late reply,

Thanks for the response Erwin. With a bit of fettling I have managed to get Bullets response to be very similar to both PhysX and ODE.

Rather than starting a new thread, I have a slightly different question I was hoping that somebody may be able to answer.

* ADMIN split topic and moved it to here: http://bulletphysics.org/Bullet/phpBB3/ ... 09&p=19678
Post Reply