Position & Orientation Based Cosserat Rods (GPU Hair & Cables)
Simulates elastic hair strands, ropes, wires, and botanical stems with coupled stretch, shear, bend, and twist using quaternion-oriented Cosserat rod segments solved in Position-Based Dynamics (XPBD).
Also known as Direct PBD Stiff Rods, Cosserat Rods
In the family Simulation & animation, strands
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Babylon.js 9.x | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Godot 4.7 | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Unity 6.0 | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Unreal 5.7 | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Blender 5.0 | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| WebGPU W3C | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
| Metal | None found | Custom GPU quaternion Cosserat rod XPBD solver; requires custom compute/physics implementation. |
How it works
Simple mass-spring chains cannot represent torsion (twist) or stiff bending without tiny timesteps. Cosserat rod theory equips each segment between particle nodes with a unit quaternion material frame (Darboux vector) tracking twist and curvature directly. Deul, Kugelstadt et al. solve stretch-shear and bend-twist constraints directly in a fast position-and-orientation PBD/XPBD loop—delivering unconditionally stable, twist-accurate strands, cables, and curls in real time on the GPU.
When to choose it
Choose for real-time curly hair, catenary power cables, ropes, whips, shoelaces, and flexible stems where bending stiffness and natural twist coupling matter.
Field marks
- Very high stiffness ratios with low sub-step counts still exhibit slight stretch unless solved with direct tridiagonal passes
- Dense strand-to-strand friction requires spatial hashing or continuum grid coupling
Presets
Cosserat Rods — animated elastic bend-and-twist strands under wind forcing
{
"P_STIFF": 0.65,
"P_WIND": 1
}Show GLSL (26 lines)
const float P_STIFF = 0.65; // P Bend Stiffness [0.1, 1.5, 0.05]
const float P_WIND = 1.0; // P Wind Force [0.0, 2.2, 0.05]
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 col = mix(vec3(0.04, 0.06, 0.10), vec3(0.09, 0.12, 0.18), smoothstep(-0.5, 0.5, uv.y));
for (int s = 0; s < 5; s++) {
float fs = float(s) - 2.0;
vec2 prev = vec2(fs * 0.18, 0.42);
float minD = 9.0;
float twistShade = 0.0;
for (int k = 1; k <= 16; k++) {
float fk = float(k) / 16.0;
float sway = sin(iTime * 2.2 + fs * 0.9 - fk * 3.2) * (0.04 + 0.18 * fk * fk) * P_WIND / max(P_STIFF, 0.25);
vec2 cur = vec2(fs * 0.18 + sway, 0.42 - fk * 0.84);
vec2 pa = uv - prev, ba = cur - prev;
float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
float segD = length(pa - ba * h);
if (segD < minD) { minD = segD; twistShade = 0.5 + 0.5 * sin(fk * 18.0 + iTime * 2.0 + fs); }
prev = cur;
}
vec3 strandCol = mix(vec3(0.28, 0.52, 0.88), vec3(0.98, 0.76, 0.34), twistShade);
col = mix(col, strandCol, smoothstep(0.015, 0.005, minD));
}
fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight
Not yet timed in the standardized NVIDIA T4 sweep. Run the browser profiler above, or time all live specimens at 1080p in Google Colab (NVIDIA T4).
Lineage
Sources
- primaryCrispin Deul, Tassilo Kugelstadt, Marcel Weiler, Jan Bender (2018). Direct Position‐Based Solver for Stiff Rods. Computer Graphics Forum.Verified via crossref · 2026-12-02doi:10.1111/cgf.13326