Help understanding term in XPBD (position based dynamics) paper

Started by
3 comments, last by coderchris 7 years, 5 months ago

The paper in question is XPBD (http://mmacklin.com/xpbd.pdf)

Equation (26) in the paper relates to adding damping to the constraint.

It contains a term that I do not understand how to evaluate - the grad C(xi - x^n) in the numerator.

For example, with a distance constraint we have grad C(a, b) = (a - b) / |a - b|

This takes two positions, and is itself a vector function, but the equation in question (26) evaluates to a scalar.

What might they mean by this term as it relates to a distance constraint?

Advertisement

I'm a bit rusty but IIRC in PBD gradC is a vector, which means gradC(xi - x^n) might be a dot product, projecting the approximate velocity (xi - x^n) onto the constraint gradient gradC.

This is just a guess! Please let me know if you work it out, because I'd like to try implementing this too. :)

I think you are correct, that seems to work nicely!

Thanks for the input.

Everything seems to behave as described in the paper, definitely an improvement over regular PBD.

The stiffness parameter is a bit tricky though, for two reasons.

By their definition (if I'm interpreting correctly), alpha = 1 / stiffness. I found this to not completely solve a constraint in one step when stiffness = 1.

So, I use a slightly modified version: alpha = (1 / stiffness) - 1. This will give alpha = 0 when stiffness is 1, which will fully solve a constraint in one step.

The second thing about the stiffness is that, although the valid range is [0, 1], how stiff it makes the constraint is highly dependent on the constraint's scaling.

For example, with the usual distance constraint C(a,b) = |a - b| - restLength, with a stiffness of 0.5 and a timestep of 1, the constraint will be reasonably stiff using XPBD.

However, using the normalized version C(a,b) = (|a - b| / restLength) - 1, will apply almost zero correction, so you need a much higher stiffness value to achieve the same effect.

Intuitively, this is due to the alpha in the denominator of the delta lambda "overpowering" the constraint.

This is not a huge issue, since you can simply scale the stiffness value based on your choice of constraint function.

Awesome! I'm glad that works :)

Thanks for letting me know about those details -- I wonder if it's an error in the paper or what.

Do normalized constraints offer any benefits? I've never come across them before.

Nah I dont think normalized constraints are any better from what I've seen.

I was playing with the normalized distance constraint because in his other paper (strain based dynamics), all the constraints are normalized.

That said, I ran into an issue getting the damping to work with strain based constraints - the damping was basically having little to no effect.

This was due to those constraints being normalized.

Turns out that the damping mechanism as described only works when the constraints are not normalized, so I'm having to unnormalize / scale the strain based constraints for damping to work on them.

I haven't figured out the exactly correct scaling though. Still trying to wrap my head around the math :blink:

This topic is closed to new replies.

Advertisement