There is so much to say I don't even know how to put it in words, so I'll pose simple questions.
Should I go with Erin Catto's PGS? Is it fast? At least a lot faster than Baraff's Dantzig-based solver (which tends to cycle a lot or not find a direction to move to and give me lots of headache?) Does it handle penetration well (not like a jittery Baumgart-ish approach?) Any tips on contact caching (doing it without consuming too much memory or clock cycles?)
Anyone tried Eran Guendelman's approach? (seems like it has a lot of voodoo magic in there... contact graphs,shock propogation, stack propogation, etc.) If you did, how did you deal with contact graphs et. all?
Please help, I feel extremely frustrated.
A Stable Nice Looking Solution
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: A Stable Nice Looking Solution
Projected Gauss Seidel is a good solution indeed. PGS and its application to rigid body dynamics constraint solving is not Erin Catto's invention, and he didn't claim that. The first mention of PGS in the rigid body context is by Moreau in 1999. Later it was discussed by Richard Tonge and Vedran Klanac on the ODE mailing list, around 2004. The method is mathematically equivalent to what Erin Catto describes as Sequential Impulse (SI), in his 2005 GDC talk.Should I go with Erin Catto's PGS?
ODE quickstep, Bullet and Box2D and several other engines provide stable implementations of PGS(=SI). Kenny Erleben's PhD provides details in chapter 6.
Good luck,
Erwin
-
- Posts: 10
- Joined: Wed Jun 14, 2006 11:41 pm
Re: A Stable Nice Looking Solution
And so I tried it!
It basically tried the SOR-LCP-1 () function in Kenny Erleben's PhD thesis with w=1 which would (I guess) turn it into the Gauss-Seidel LCP solver. A fixed iteration limit of 10 (no stopping criteria checking) and no contact caching as that would need some additional serious work and I usually break contacts a lot in my engine (lots of random motion). the lo chosen was 0.0 always, and hi chosen was the impulse every contact would get in the absence of all other contacts. I also tried a hi of 100.0 for all as well(very large impulse for my current objects.) For warmstarting, I tried half of each predicted impulse in the absence of all other contacts. Contacts moving away from surface always got a warmstart of 0.0.
works fine for like 7 boxes but as soon as 17 or 18 boxes get stacked, the physics engine starts to slow down. However when I tried a naive 'split-impulse' like approach, I wouldn't get that kind of slowdown until like 60 to 70 boxes all crammed on top of each other.
Also I saw objects sinking into each other two (stack of 3).. is this an indicator of the need of a "First Order World" error correction as stated in Kenny Erleben's thesis?
It basically tried the SOR-LCP-1 () function in Kenny Erleben's PhD thesis with w=1 which would (I guess) turn it into the Gauss-Seidel LCP solver. A fixed iteration limit of 10 (no stopping criteria checking) and no contact caching as that would need some additional serious work and I usually break contacts a lot in my engine (lots of random motion). the lo chosen was 0.0 always, and hi chosen was the impulse every contact would get in the absence of all other contacts. I also tried a hi of 100.0 for all as well(very large impulse for my current objects.) For warmstarting, I tried half of each predicted impulse in the absence of all other contacts. Contacts moving away from surface always got a warmstart of 0.0.
works fine for like 7 boxes but as soon as 17 or 18 boxes get stacked, the physics engine starts to slow down. However when I tried a naive 'split-impulse' like approach, I wouldn't get that kind of slowdown until like 60 to 70 boxes all crammed on top of each other.
Also I saw objects sinking into each other two (stack of 3).. is this an indicator of the need of a "First Order World" error correction as stated in Kenny Erleben's thesis?
-
- Posts: 10
- Joined: Wed Jun 14, 2006 11:41 pm
Success! (somewhat)
Ok I hope someone reads the following:
Wow, I arrived at a nice stable looking solution. Sorry to say it wasn't PGS, maybe if I had forced my lazy self a bit more to read the literature on the subject I would've definitely made a full fledged solver and system for it
(with all the shiny stuff like contact graphs and contact caching.)
Anyway, I basically went through all the impulses in the scene and applied them separately, and did this for all the contacts 10 times (ran through all contacts, then ran again and so on...), applied friction along the way and also since I'm too lazy to make a full fledged shock prorogation routine with a full fledged system constructing a full fledged contact graph, I just did the prorogation on regular objects facing immovable objects (mass = infinite). Basically just ran through contacts facing mass=inf as the last step to make sure NO object is going to move towards immovable mass before position update.
Also I used a LinearVelocityMagnitude + AngularVelocityMagnitude < threshold to stop objects from rattling around on the floor. They settled quite nicely.
Overall, I loved it, even though stacks at levels above the object on the floor, would try to sink it to the object at ground level (in other words 'failed'). Obviously REAL shock prorogation would avoid that, even though it would introduce other problems such as TOO-stable stacks.
YAY, I'm happy now!
And thanks for keeping this forum alive, I don't know of any other place that people are either willing to help or have the knowledge to.
Wow, I arrived at a nice stable looking solution. Sorry to say it wasn't PGS, maybe if I had forced my lazy self a bit more to read the literature on the subject I would've definitely made a full fledged solver and system for it

Anyway, I basically went through all the impulses in the scene and applied them separately, and did this for all the contacts 10 times (ran through all contacts, then ran again and so on...), applied friction along the way and also since I'm too lazy to make a full fledged shock prorogation routine with a full fledged system constructing a full fledged contact graph, I just did the prorogation on regular objects facing immovable objects (mass = infinite). Basically just ran through contacts facing mass=inf as the last step to make sure NO object is going to move towards immovable mass before position update.
Also I used a LinearVelocityMagnitude + AngularVelocityMagnitude < threshold to stop objects from rattling around on the floor. They settled quite nicely.
Overall, I loved it, even though stacks at levels above the object on the floor, would try to sink it to the object at ground level (in other words 'failed'). Obviously REAL shock prorogation would avoid that, even though it would introduce other problems such as TOO-stable stacks.
YAY, I'm happy now!
And thanks for keeping this forum alive, I don't know of any other place that people are either willing to help or have the knowledge to.
-
- Posts: 231
- Joined: Tue Feb 20, 2007 4:56 pm
Re: Success! (somewhat)
Sorry, I'm a bit confused, how is that not PGS/SI?jam wrote:Wow, I arrived at a nice stable looking solution. Sorry to say it wasn't PGS
...
Anyway, I basically went through all the impulses in the scene and applied them separately, and did this for all the contacts 10 times
-
- Posts: 10
- Joined: Wed Jun 14, 2006 11:41 pm
Re: A Stable Nice Looking Solution
well, isn't Projected Gauss-Seidel an LCP solver?bone wrote:Sorry, I'm a bit confused, how is that not PGS/SI?
if you're using the LCP formulation, you're solving all impulses at-once.
-
- Posts: 231
- Joined: Tue Feb 20, 2007 4:56 pm
Re: A Stable Nice Looking Solution
OK, I think I understand the confusion.
Yes, PGS solves LCPs. But "Gauss-Seidel" (GS) basically means to solve the equations iteratively. This may not be obvious, but as Erwin mentioned, this is mathematically equivalent to SI (Sequential Impulses).
So it sounds like what you are using is Sequential Impulses, which in my head I consider to be the same as PGS. But the implementation is different; one would probably implement PGS by setting up a big matrix to solve, and then solve chunks at a time iteratively.
Yes, PGS solves LCPs. But "Gauss-Seidel" (GS) basically means to solve the equations iteratively. This may not be obvious, but as Erwin mentioned, this is mathematically equivalent to SI (Sequential Impulses).
So it sounds like what you are using is Sequential Impulses, which in my head I consider to be the same as PGS. But the implementation is different; one would probably implement PGS by setting up a big matrix to solve, and then solve chunks at a time iteratively.