Post Stabilization

Please don't post Bullet support questions here, use the above forums instead.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post Stabilization

Post by Dirk Gregorius »

Dear group,

I implemented post stabilization today like proposed in the PhD of B. Cline. Especially for contacts this has the advantage that the interpenetration resolvement doesn't contribute to the pesistent momentum. One thing that is not clear from the paper is if I need to rebuild the Jacobian after the position update or if I can use the same Jacobian like before the position update?
Second Bradley stated that the actual result of the LPC is a velocity rather then a displacement. So do I need to integrate the result after running the LCP solver? I use the same LCP solver like the ODE (SOR). I only set the CFM to zero and simply pass the penetration depth as b. Is this correct?

What about mixing Baumgarte and Post Stabilization. When I do this I need to find the penetration depth after the position update that has been resolved through the Baumgarte term: ERP * Depth / dt. I did this by saving the contact point also in relative coordinates to the involved collision geometries. This way I am able to compute the new penetration depth after the position update and feed this into the second LCP. Any other recommendations? What are your experiences?

Maybe we start a poll - what do you prefer:

a) Penalty method - aka Baumgarte stabilization for Time-Stepping
b) Post Stabilization
c) A hybrid form of both

Regards,

Dirk
kenny
Posts: 32
Joined: Thu Jun 30, 2005 8:49 am
Location: Denmark

Re: Post Stabilization

Post by kenny »

DonDickieD wrote: I implemented post stabilization ...[snip]... has the advantage that the interpenetration resolvement doesn't contribute to the pesistent momentum.
Persistent momentum?
DonDickieD wrote: One thing that is not clear from the paper is if I need to rebuild the Jacobian after the position update or if I can use the same Jacobian like before the position update?
Yes you can reuse your Jacobians, just ignore the tangential directions. This means you can solve for the constraint impulse/force and the projection in the same step. This is easily implemented using something like PGS, you work on two Lagrange multiplier vectors and right hand sides at the same time.
DonDickieD wrote: Second Bradley stated that the actual result of the LPC is a velocity rather then a displacement. So do I need to integrate the result after running the LCP solver?
It is just first order world physics, but set delta_t = 1 and use a simple Euler update scheme, this works fine for me.
DonDickieD wrote: I use the same LCP solver like the ODE (SOR). I only set the CFM to zero and simply pass the penetration depth as b. Is this correct?
Yes, and throw away tangential directions as well. Note you can still keep the regularization if you want. This improves the numerics and dampens the projection lengths (alleviates overshooting, but do not remove the problem:-)
DonDickieD wrote: What about mixing Baumgarte and Post Stabilization.
Post- and pre stabilization is good for different things. As far as I know people already mix the two kinds of stabilization.
DonDickieD wrote: This way I am able to compute the new penetration depth after the position update and feed this into the second LCP. Any other recommendations? What are your experiences?
Do your error correction before the dynamics then you can ``trust'' your penetration depths. Or solve for both the constraint forces and projections using the same LCP.

There is little difference in whether you do projection followed by dynamics or vice versa. Any cyclic permutation of the same order of events in your simulation loop will get you to the same place. The difference in the choices have more to do with praticalities... howto estimate good penetration depths after a position update (without having to run another collision query) kind of problems...

On a side-note Baraff used post-stabilization formulated as an LCP prior to Cline, see

Code: Select all

@article{618272,
 author = {David Baraff},
 title = {Interactive Simulation of Solid Rigid Bodies},
 journal = {IEEE Comput. Graph. Appl.},
 volume = {15},
 number = {3},
 year = {1995},
 issn = {0272-1716},
 pages = {63--75},
 doi = {http://dx.doi.org/10.1109/38.376615},
 publisher = {IEEE Computer Society Press},
 address = {Los Alamitos, CA, USA},
 }
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

howto estimate good penetration depths after a position update (without having to run another collision query) kind of problems...
I do this by storing the contact point in reltative coordinates. Such that I can transform back into world space after the Baumgarte correction and project it onto the collision normal. I did some simple tests and it seemed to work. If I use an ERP of 0.2 I can assume that the same contact still exists and find the new penetration depth this way.

Regards,

Dirk
mbcline
Posts: 1
Joined: Wed Sep 21, 2005 9:18 pm

I'm that dude with the paper you guys are talking about

Post by mbcline »

Glad to see that someone outside my thesis committee was interested in reading my thesis! It's been a couple years since I wrote it or thought about it at any depth, but I'll do my best to try to answer your questions about it.
One thing that is not clear from the paper is if I need to rebuild the Jacobian after the position update or if I can use the same Jacobian like before the position update?
The Jacobian is a function of the positions of the bodies, so it will be different after you update the bodies. So, yes when I implemented it I would recalc the jacobian after doing the position update, but before the post-stabilization.

Assuming small time steps though, the difference in J before and after doing the position update might not be all that large, and so the post-stabilization step might work reasonably well even if you don't update the Jacobian. I've never tried it, so I don't know how well it would work. As Kenny points out, this would allow you to potentially collapse the two LCP's into one big one. I have heard that Anitescu, who I cite a bunch of times in my thesis, published a paper showing this a little after my thesis.
Second Bradley stated that the actual result of the LCP is a velocity rather then a displacement. So do I need to integrate the result after running the LCP solver?
The way I was doing it was a two-step approach that involved solving two LCP's per time-step

1. Solve a velocity-level LCP - Find a velocity that satisfies all velocity-constraints
2. Using that velocity, update the positions of the bodies
3. Solve a position-level LCP - Find a delta-position to add to the position from step 2 so that the new position satisfies all position-constraints.
On a side-note Baraff used post-stabilization formulated as an LCP prior to Cline, see (...citation...)
I'm not sure I've run across that one. Does anyone have an electronic copy of this? I could not locate one online. It's entirely possible that Baraff thought of the idea a decade before me. :)
(Erwin wrote this to me in a separate private message:)

Does your paper apply to the typical situation where you can choose between solving the positional/zero order part either combined with first order/velocity LCP or as a seperate LCP ? Or is it just for small drift due to numerical instability ? Or did I mix up post and pre stabilization ?
The post-stabilization LCP was just to counteract the small drift encountered after solving the velocity LCP and updating the position.

Mike Cline
Antonio Martini
Posts: 126
Joined: Wed Jul 27, 2005 10:28 am
Location: SCEE London

Re: Post Stabilization

Post by Antonio Martini »

kenny wrote: On a side-note Baraff used post-stabilization formulated as an LCP prior to Cline, see

Code: Select all

@article{618272,
 author = {David Baraff},
 title = {Interactive Simulation of Solid Rigid Bodies},
 journal = {IEEE Comput. Graph. Appl.},
 volume = {15},
 number = {3},
 year = {1995},
 issn = {0272-1716},
 pages = {63--75},
 doi = {http://dx.doi.org/10.1109/38.376615},
 publisher = {IEEE Computer Society Press},
 address = {Los Alamitos, CA, USA},
 }
in the paper above contact constraints are treated as bilateral constraints. So it's not formulated as an LCP like in Cline is it?

from the Baraff's paper:

"
We will compute constraint force magnitudes by treating all the contact
constraints as bilateral constraints and solving the linear equation

Af = -b
"