PBD Notes
Engine
- number of constraint iterations
- number of substeps
- Type: Pbd or Xpbd
Substep
- External Forces override
- Update particle velocity:
- Compute predicted position
- Generate Collision Constraints override
- Reset Lagrange multipliers (XPBD-only)
- Solve constraints
- Compute new velocity
- Update position
- Update Velocities (Damping) override
- Clear some instant constraints (like collision etc.)
- Advance current time
Particle
: current frame position : velocity : predicted position : forces : mass : 1/mass
Constraint
Abstract Class
Type: Bilateral or Unilateral
particles
stiffness (PBD)
compliance (XPBD)
(XPBD) Lagrange multiplier
Calculate the constraint function value C(x)
Calculate the derivative of the constraint function grad C(x)
Project associated particles to the constraint manifold
Project Particle
1 | // constraint function value |
Different Type of Constraints
Some Derivation:
where
When comes to the gradient of a normalized cross product:
Substituting back:
Distance Constraint
, particles involved- stiffness/compliance
- d: rest length
C(x)
1 | return (p_0->p - p1->p).norm() - d; |
Gradient
Derivation:
1 | const Vector3d& x_0 = p_0->p; |
Bending Constraint
: vertices on a pair of adjacent triangles- stiffness/compliance
- dihedral angle
C(x)
1 | const Vector3 p10 = p1 - p0; |