Hey
Right now I'm at the point where I'm trying to completely understand how Box2D (and impulse based methods in general) works, and had a few questions. Any help will be appreciated
So I just finished going through 'nonconvex rigid bodies with stacking', and (I believe) I understand how the method described there works. What would really help me is to understand how that method is different from erin's, and what advantages/disadvantages it has.
To be a bit more specific:
From what I got, it looks like Guendelman uses corrective impulses to separate the velocities and account for friction and reinstitution (ie, the collision phase). Then he applies impulses with no reinstitution to fix the penetrating contacts... (please correct me if I'm wrong)
So is the second phase (contacts) similar to erin's position correction phase? How are they different?
Comparing Box2D and 'Rigid bodies with stacking'
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
-
- Posts: 316
- Joined: Fri Jul 01, 2005 5:29 am
- Location: Irvine
Re: Comparing Box2D and 'Rigid bodies with stacking'
I haven't implemented the NCRBWS algorithm, but my understanding is that they have no position correction.
Box2D combines collision and contact by using a velocity bias for restitution. Box2D also does not use shock propagation. Finally, Box2D clamps the accumulated impulse, which NCRBWS does not.
Box2D combines collision and contact by using a velocity bias for restitution. Box2D also does not use shock propagation. Finally, Box2D clamps the accumulated impulse, which NCRBWS does not.
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
Re: Comparing Box2D and 'Rigid bodies with stacking'
Thanks for the reply Erin. few more questions, if you don't mind
How can it be done without some sort of stabilization/projection ?
Thanks for the help
Oz
How do they battle position drift then? If you happen to know..Erin Catto wrote:I haven't implemented the NCRBWS algorithm, but my understanding is that they have no position correction.
How can it be done without some sort of stabilization/projection ?
Is that what's described by the split impulses method? From what I've read here it sounded like you gave up on that method and decided to go with a separate position correction sweep after velocity correction.. or am I totally off?Erin Catto wrote:Box2D combines collision and contact by using a velocity bias for restitution
Do you think box2d could benefit from shock propagation? It's something I was thinking about implementing at some point, and was wondering why I haven't seen it used that much.Erin Catto wrote:Box2D also does not use shock propagation
So clamping the accumulated impulse makes sure that it's never negative, therefore satisfying the inequality constraint... is that about right?Erin Catto wrote:Box2D clamps the accumulated impulse, which NCRBWS does not.
Thanks for the help
Oz
-
- Posts: 316
- Joined: Fri Jul 01, 2005 5:29 am
- Location: Irvine
Re: Comparing Box2D and 'Rigid bodies with stacking'
You can run without position stabilization, you will just get a little penetration. The amount of penetrations depends on the time step and the number of iterations in the velocity solver.oztune wrote:How do they battle position drift then? If you happen to know..
How can it be done without some sort of stabilization/projection ?
No restitution handling is independent of split impulses. Split impulses was an attempt to reduce the influence of Baumgarte style position correction on the momentum. With Baumgarte position correction you can get some bounce even when the restitution is zero. I did abandon split impulses in favor of a separate post projection of position errors.oztune wrote:Is that what's described by the split impulses method? From what I've read here it sounded like you gave up on that method and decided to go with a separate position correction sweep after velocity correction.. or am I totally off?
I tried shock propagation before and abandoned it because the results were often physically and visually incorrect. For example, this configuration is stable with SP:oztune wrote:Do you think box2d could benefit from shock propagation? It's something I was thinking about implementing at some point, and was wondering why I haven't seen it used that much.

By clamping the accumulated impulse you allow individual corrective impulses in the solver loop to become negative. This allows us to reduce overly large impulses down to the correct level. The accumulated impulse remains positive.oztune wrote:So clamping the accumulated impulse makes sure that it's never negative, therefore satisfying the inequality constraint... is that about right?
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
Re: Comparing Box2D and 'Rigid bodies with stacking'
Thanks for all your responses Erin. I feel closer to being a physics master with every post 
(Sorry for all the long questions...)
Thank you,
Oz

(Sorry for all the long questions...)
So just solving all the velocity constraints enough times 'should' resolve all penetration..Erin Catto wrote:You can run without position stabilization, you will just get a little penetration. The amount of penetrations depends on the time step and the number of iterations in the velocity solver.
I see.. I guess I over simplified things a bit. What then is the real difference between collision and contact solving? and where does reinstitution handling come in?Erin Catto wrote:No restitution handling is independent of split impulses.
So you still use Baumgarte stabilization then? I'm actually having trouble grasping exactly what it does... I've looked for Baugarte's paper but I can't find more than it's citations (unpaid at least). Plus, the mathematical terms tend to over complicate things in my mind...Erin Catto wrote:Split impulses was an attempt to reduce the influence of Baumgarte style position correction on the momentum. With Baumgarte position correction you can get some bounce even when the restitution is zero. I did abandon split impulses in favor of a separate post projection of position errors.
NCRBWS presents a technique which performs several regular iterations on stacks, followed by shock propegation.. wouldn't that make things a lot more stable, while keeping realistic behavior?Erin Catto wrote:I tried shock propagation before and abandoned it because the results were often physically and visually incorrect. For example, this configuration is stable with SP:
Ok. Why would you encounter those overly large impulses in the first place? Do you know of any visual example of this?Erin Catto wrote:By clamping the accumulated impulse you allow individual corrective impulses in the solver loop to become negative. This allows us to reduce overly large impulses down to the correct level. The accumulated impulse remains positive.
Thank you,
Oz
-
- Posts: 316
- Joined: Fri Jul 01, 2005 5:29 am
- Location: Irvine
Re: Comparing Box2D and 'Rigid bodies with stacking'
No, but it helps to prevent the penetrations from becoming larger.oztune wrote:So just solving all the velocity constraints enough times 'should' resolve all penetration..
In Box2D there is no difference between collision and contact solving except that restitution is handled with a velocity bias. Please see my 2008 presentation: http://www.gphysics.com/downloads.oztune wrote:I see.. I guess I over simplified things a bit. What then is the real difference between collision and contact solving? and where does reinstitution handling come in?
See the '08 presentation.oztune wrote:So you still use Baumgarte stabilization then? I'm actually having trouble grasping exactly what it does... I've looked for Baugarte's paper but I can't find more than it's citations (unpaid at least). Plus, the mathematical terms tend to over complicate things in my mind...
Yet it still produces the artifact I showed. I encourage you to try it yourself.oztune wrote:NCRBWS presents a technique which performs several regular iterations on stacks, followed by shock propegation.. wouldn't that make things a lot more stable, while keeping realistic behavior?
This happens because the solver is iterative. Constraints are not directly aware of each other and may over compensate. Again, I encourage you to experiment with your own code or Box2D_Lite. You can easily disable accumulated impulse clamping.oztune wrote:Ok. Why would you encounter those overly large impulses in the first place? Do you know of any visual example of this?
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
Re: Comparing Box2D and 'Rigid bodies with stacking'
I will go over those slides again. Thanks for all the help, I really appreciate it!