Extended Position-Based Dynamics
Adds a compliance term to position-based constraint solving so stiffness is a real material parameter independent of time step and iteration count, while keeping PBD's stability.
Also known as Extended PBD
In the family Simulation & animation, particle/constraint solvers
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | Built in | SoftBody3D with JoltPhysics3D solves soft bodies via Extended Position-Based Dynamics (Jolt SoftBodyMotionProperties) docs |
| Unity | None found | |
| Unreal 5.7 | Built in | Cloth Panel Node Editor: add XPBD constraints to a Chaos Cloth asset docs Chaos Cloth; optional XPBD constraint types in the panel cloth editor. |
| Blender 5.2 | Built in | Geometry Nodes > Simulation > XPBD Solver docs For hair, cloth and particles. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
XPBD derives from implicit Euler with a constraint energy 1/2 C^T alpha^{-1} C, where alpha is inverse stiffness (compliance). It keeps a Lagrange multiplier per constraint across iterations of the same step. Each iteration computes a multiplier increment dlambda = (-C - alpha~ * lambda) / (grad C M^-1 grad C^T + alpha~) with alpha~ = alpha/dt^2, then applies the position change along the gradient. When compliance is zero it reduces to plain PBD; when it is positive the constraint behaves like a spring whose force converges to the true implicit solution as iterations increase. Since the multiplier is also the constraint force (times dt^2), it can be used to read out forces for e.g. breakable joints. Combined with substepping it is the common modern realtime solver.
When to choose it
Reach for it when
- cloth stiffness changes with frame rate or iterations
- need position-based solver with real material stiffness
- want breakable constraints and motors with force readout
- position-based dynamics feels time-step dependent
- stable soft-body or rope simulation with consistent behaviour
Choose it when you want PBD's robustness but need consistent stiffness across frame rates, or need constraint forces (breaking, motors). Prefer Position Based Dynamics only for the very simplest cases where one scalar is enough, Soft Step solver / substepping / substepping for rigid-body-dominant scenes, and Vertex Block Descent when you need guaranteed convergence on stiff, high-ratio cloth.
Field marks
- Still not exact: very stiff constraints with few iterations remain soft
- Large mass ratios converge slowly even with compliance
- Damping must be added as a separate constraint-space term or motion looks overly dissipative
- Multiplier history makes constraint add/remove mid-step (contacts) slightly fiddly
Presets
XPBD — stiff PBD alpha=0 (left) vs compliant XPBD elastic chain & strain heatmap (right)
{
"P_COMPLIANCE": 0.42,
"P_GRAVITY": 1,
"P_SPEED": 1,
"P_SPLIT": 0.48
}Show GLSL (163 lines)
const float P_COMPLIANCE = 0.42; // P Compliance Alpha [0.0, 1.5, 0.02]
const float P_GRAVITY = 1.0; // P Gravity Load [0.2, 2.2, 0.05]
const float P_SPEED = 1.0; // P Osc Speed [0.0, 2.5, 0.05]
const float P_SPLIT = 0.48; // P PBD / XPBD Split [0.0, 1.0, 0.02]
float sdSeg(vec2 p, vec2 a, vec2 b, out float h) {
vec2 pa = p - a;
vec2 ba = b - a;
h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
return length(pa - ba * h);
}
vec3 strainRamp(float s) {
float t = clamp(s, 0.0, 1.0);
vec3 c0 = vec3(0.14, 0.62, 0.92);
vec3 c1 = vec3(0.18, 0.88, 0.62);
vec3 c2 = vec3(0.98, 0.72, 0.16);
vec3 c3 = vec3(0.96, 0.24, 0.22);
if (t < 0.33) return mix(c0, c1, t * 3.0);
if (t < 0.66) return mix(c1, c2, (t - 0.33) * 3.0);
return mix(c2, c3, (t - 0.66) * 3.0);
}
// Compute node position of a 7-node elastic XPBD chain with compliance alpha
vec2 xpbdNode(int idx, float alpha, float grav, float t, float xOff) {
float fi = float(idx);
float restL = 0.105;
vec2 anchor = vec2(xOff, 0.36);
if (idx == 0) return anchor;
// Iterative XPBD equilibrium: dLambda = (-C - alphaTilde * lam) / (wSum + alphaTilde)
// Static stretch scales with alphaTilde * loadBelow; dynamic swing scales with compliance
float dt = 0.016;
float alphaTilde = alpha * 0.0018 / (dt * dt + 1e-5);
float wSum = 2.0;
float kComp = alphaTilde / (wSum + alphaTilde + 1e-5);
float swayPhase = t * (2.15 - 0.55 * kComp);
float wind = 0.11 * sin(swayPhase) + 0.045 * sin(swayPhase * 2.3 + 0.8);
vec2 pos = anchor;
for (int k = 1; k <= 7; k++) {
if (k > idx) break;
float fk = float(k);
float loadBelow = (8.0 - fk) * grav;
// XPBD analytical steady-state compliance elongation per link
float stretch = restL * (0.018 + 0.24 * kComp * loadBelow * 0.28);
float L = restL + stretch;
float ang = wind * (0.55 + 0.34 * fk) * (1.0 + 0.65 * kComp) + 0.08 * sin(swayPhase * 1.4 - fk * 0.52) * (0.4 + kComp);
pos += vec2(sin(ang), -cos(ang)) * L;
}
return pos;
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float px = 1.0 / max(iResolution.y, 1.0);
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
float alphaRight = max(P_COMPLIANCE, 0.0);
float grav = clamp(P_GRAVITY, 0.2, 2.5);
float t = iTime * max(P_SPEED, 0.0);
// Dark engineering blueprint grid
vec3 col = mix(vec3(0.028, 0.038, 0.058), vec3(0.055, 0.074, 0.112), smoothstep(-0.5, 0.5, uv.y));
vec2 g1 = abs(fract(uv * 10.0 - 0.5) - 0.5);
vec2 g2 = abs(fract(uv * 2.0 - 0.5) - 0.5);
col += vec3(0.016, 0.024, 0.038) * smoothstep(0.035, 0.008, min(g1.x, g1.y));
col += vec3(0.028, 0.042, 0.068) * smoothstep(0.014, 0.003, min(g2.x, g2.y));
// Top ceiling beam
float dBeam = abs(uv.y - 0.385) - 0.025;
col = mix(col, vec3(0.16, 0.20, 0.27), smoothstep(px * 2.0, 0.0, dBeam));
float hatch = smoothstep(0.45, 0.55, sin((uv.x + uv.y) * 90.0));
col = mix(col, vec3(0.24, 0.30, 0.39), smoothstep(px * 2.0, 0.0, dBeam) * hatch * 0.45);
// Draw two chains on each side (stiff left alpha=0, compliant right alpha=P_COMPLIANCE)
float restL = 0.105;
for (int side = 0; side < 2; side++) {
bool isRight = (side == 1);
float alpha = isRight ? alphaRight : 0.0;
float xBase = isRight ? 0.34 : -0.34;
float sideMask = isRight ? smoothstep(split - 0.004, split + 0.004, screenX) : smoothstep(split + 0.004, split - 0.004, screenX);
// Draw two coupled strands forming a narrow compliant ladder/ribbon
for (int strand = 0; strand < 2; strand++) {
float dx = (strand == 0) ? -0.095 : 0.095;
vec2 prevP = xpbdNode(0, alpha, grav, t + float(strand) * 0.18, xBase + dx);
vec2 prevRest = vec2(xBase + dx, 0.36);
for (int i = 1; i <= 7; i++) {
vec2 curP = xpbdNode(i, alpha, grav, t + float(strand) * 0.18, xBase + dx);
vec2 curRest = vec2(xBase + dx, 0.36 - float(i) * restL);
// Rest-length ghost guide
float hGhost;
float dGhost = sdSeg(uv, prevRest, curRest, hGhost);
float dash = step(0.5, fract(hGhost * 4.0));
col += vec3(0.16, 0.22, 0.32) * smoothstep(px * 2.2, px * 0.5, dGhost) * dash * 0.45 * sideMask;
// Elastic constraint spring segment
float hSeg;
float dSeg = sdSeg(uv, prevP, curP, hSeg);
float segLen = length(curP - prevP);
float strain = clamp((segLen - restL) / (restL * 0.38), 0.0, 1.0);
vec3 sCol = strainRamp(strain);
// Coiled spring wave modulation along the segment
vec2 dir = (curP - prevP) / max(segLen, 1e-5);
vec2 perp = vec2(-dir.y, dir.x);
float coils = sin(hSeg * 6.2831853 * 6.0) * (0.011 - 0.004 * strain);
vec2 springPt = mix(prevP, curP, hSeg) + perp * coils * smoothstep(0.0, 0.12, hSeg) * smoothstep(1.0, 0.88, hSeg);
float dSpring = length(uv - springPt);
float linkCore = smoothstep(0.0085, 0.003, dSeg);
float coilGlow = smoothstep(0.007, 0.002, dSpring);
col = mix(col, sCol * 1.15, max(linkCore * 0.72, coilGlow * 0.92) * sideMask);
// Horizontal shear rung between the two strands
if (strand == 1) {
vec2 leftP = xpbdNode(i, alpha, grav, t, xBase - 0.095);
float hRung;
float dRung = sdSeg(uv, leftP, curP, hRung);
float rungStrain = clamp(abs(length(curP - leftP) - 0.19) / 0.08, 0.0, 1.0);
col = mix(col, strainRamp(rungStrain) * 0.85, smoothstep(0.006, 0.002, dRung) * 0.75 * sideMask);
}
// Mass node sphere + compliance energy halo
float rNode = (i == 7) ? 0.028 : 0.019;
float dNode = length(uv - curP);
if (dNode < rNode) {
vec2 local = (uv - curP) / rNode;
float z = sqrt(max(1.0 - dot(local, local), 0.0));
vec3 n = normalize(vec3(local, z));
float diff = max(dot(n, normalize(vec3(0.45, 0.7, 0.6))), 0.0);
float spec = pow(max(dot(n, normalize(vec3(0.3, 0.5, 1.0))), 0.0), 32.0);
vec3 nodeCol = mix(vec3(0.75, 0.84, 0.96), sCol, 0.45) * (0.35 + 0.75 * diff) + vec3(0.95) * spec * 0.7;
col = mix(col, nodeCol, sideMask);
}
float halo = smoothstep(rNode + 0.016, rNode, dNode) * smoothstep(rNode - 0.002, rNode + 0.004, dNode);
col += sCol * halo * (0.35 + 0.65 * strain) * sideMask;
prevP = curP;
prevRest = curRest;
}
// Anchor pin
float dPin = length(uv - vec2(xBase + dx, 0.36));
col = mix(col, vec3(0.95, 0.82, 0.36), smoothstep(0.018, 0.011, dPin) * sideMask);
}
}
// Split divider line
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.94, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| xpbd-live | Tesla T4 1920x1080 | 145× baseline (extreme) · 4.50 ms / 4.74 ms | opengl-timer-query · 36 frames · GPU Weight Atlas · Colab T4 sweep |
| xpbd-live | NVIDIA L4 1920x1080 | 130× baseline (extreme) · 2.06 ms / 2.12 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| xpbd-live | NVIDIA A100-SXM4-40GB 1920x1080 | 102× baseline (extreme) · 2.92 ms / 2.92 ms · 1.5× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Implicit cloth integration (Baraff-Witkin), Position Based Fluids, Unified particle physics; cited by Soft Step solver / substepping.
Crosses
- Deformable XPBD soft bodies carved straight from NeuS captures: Objects reconstructed as watertight neural signed distance fields via NeuS become immediately squishy, tearable, or elastic XPBD soft bodies without manual retopology or hand-authored collision cages.
Sources
- primaryMiles Macklin, Matthias Müller, Nuttapong Chentanez (2016). XPBD. Proceedings of the 9th International Conference on Motion in Games.Verified via crossref · 2026-11-29doi:10.1145/2994258.2994272
- primaryMiles Macklin, Kier Storey, Michelle Lu, Pierre Terdiman, Nuttapong Chentanez, Stefan Jeschke et al. (2019). Small steps in physics simulation. Proceedings of the 18th annual ACM SIGGRAPH/Eurographics Symposium on Computer Animation.Verified via crossref · 2026-11-29doi:10.1145/3309486.3340247
- implementationInteractiveComputerGraphics (2015). InteractiveComputerGraphics/PositionBasedDynamics. PositionBasedDynamics is a library for the physically-based simulation of rigid bodies, deformable solids and fluids.GitHub API · license MIT · 2026-11-29