Contents · Physics Engines
Part 0 · Orientation
Part 1 · Mathematical Foundations
Part 2 · Equations of Motion
Part 3 · Time Integration
Part 4 · Collision Detection
Part 5 · Contact & Constraints
Part 6 · Constraint Solvers
Part 7 · Position-Based Dynamics
- Position-Based Dynamics and XPBD
Part 8 · GPU & Parallelism
Part 9 · Differentiable Simulation
Part 7 · Position-Based Dynamics
Position-Based Dynamics and XPBD
Most solvers compute forces, integrate them into velocities, then integrate those into positions. Position-based dynamics throws out the middle steps: guess where the particles want to go, then push them until the constraints hold.
Skip the forces
Start from a symplectic-Euler prediction of the unconstrained positions,
then move the predicted state so every constraint is satisfied, and recover velocity from the position change,
PBD does the projection with a fixed number of Gauss-Seidel passes.1 It is fast and unconditionally stable, which is why cloth and ropes in games run on it. The catch is the stiffness. A stiff constraint is one you correct hard; PBD "corrects hard" by iterating more, so the effective stiffness rides on the iteration count and the timestep. The same cloth feels limp at 5 iterations and board-stiff at 50, with no physical number you can point to.
Compliance makes stiffness a number
XPBD fixes this by giving each constraint a compliance , the inverse of its stiffness, and a Lagrange multiplier that accumulates the constraint force.2 Projecting the predicted positions against the constraint and its compliance is one Newton step on the coupled system
Eliminating leaves a scalar update per constraint,
where is the inverse mass of particle . The scaling is the whole trick: it cancels the timestep out of the update, so becomes a physical, step- and iteration-independent quantity. As the denominator collapses to and you recover rigid PBD; a larger enlarges the denominator, so the correction is deliberately partial and the constraint is allowed to stretch.
One step by hand
Take a single distance constraint between two particles. Particle is pinned, so , at . Particle is free, , at . The rest length is and . Take first.
The constraint value is the current length minus the rest length,
The gradient points along the segment,
With the scaled compliance is , and since , the denominator is . Starting from ,
The pinned particle does not move (). The free particle moves by
so rises from to . Recompute: the length is now exactly , so . One step, constraint solved.
Now let , say , keeping . Then , and
The particle only climbs to , leaving of stretch after the step. That residual is not solver error; it is the compliant spring holding its length under load, which is exactly what a finite stiffness is supposed to do.
The rope, live
The demo below is that same update run on a chain of twelve particles, top one pinned, gravity pulling the rest down. Each frame runs substeps, and each substep does one projection sweep with the formula above.
Slide S from 1 to 20: the stretch barely moves, because α, not the iteration count, sets the stiffness. Slide α right and the rope sags below the rest-length line.
The stiff end holds its length: the tip sits on the dashed rest-length line. The soft end visibly stretches under gravity, settling where the compliant tension balances the weight below. The point worth watching is the substep slider: in plain PBD, more substeps means a stiffer rope, but here owns the stiffness and only buys accuracy, so the rope's droop hardly changes as you sweep it.
That link between compliance and the timestep is also the bridge to the rest of the solver story. XPBD with one iteration per substep is a quasi-Newton step on the same implicit-Euler system the constraint solvers target directly, which is why it slots so naturally into the massively parallel, substepped engines coming up next.
Footnotes
-
Müller, Heidelberger, Hennix & Ratcliff, Position Based Dynamics (2007). ↩
-
Macklin, Müller & Chentanez, XPBD: Position-Based Simulation of Compliant Constrained Dynamics (MiG 2016). ↩