{
 "id": "cosserat-rods-pbd",
 "title": "Position & Orientation Based Cosserat Rods (GPU Hair & Cables)",
 "aliases": [
  "Direct PBD Stiff Rods",
  "Cosserat Rods"
 ],
 "domain": "simulation",
 "subdomain": "strands",
 "stage": "simulation",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "cuda",
  "webgpu"
 ],
 "year_introduced": 2018,
 "inputs": [
  "curves"
 ],
 "outputs": [
  "curves",
  "animation"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "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).",
 "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_use": "Choose for real-time curly hair, catenary power cables, ropes, whips, shoelaces, and flexible stems where bending stiffness and natural twist coupling matter.",
 "cost": {
  "class": "cheap",
  "notes": "Parallelizes per-strand in compute shaders; thousands of strands run at <1ms on desktop GPUs."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1111/cgf.13326",
   "type": "paper",
   "title": "Direct Position‐Based Solver for Stiff Rods",
   "authors": [
    "Crispin Deul",
    "Tassilo Kugelstadt",
    "Marcel Weiler",
    "Jan Bender"
   ],
   "year": 2018,
   "venue": "Computer Graphics Forum",
   "url": "https://doi.org/10.1111/cgf.13326",
   "ids": {
    "doi": "10.1111/cgf.13326"
   },
   "license": null,
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111%2Fcgf.13326",
     "checked_at": "2026-12-02T02:40:24.869Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111%2Fcgf.13326",
     "checked_at": "2026-12-02T02:40:24.869Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111%2Fcgf.13326",
     "checked_at": "2026-12-02T02:40:24.869Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111%2Fcgf.13326",
     "checked_at": "2026-12-02T02:40:24.869Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111%2Fcgf.13326",
     "checked_at": "2026-12-02T02:40:24.869Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-12-02T02:40:24.869Z",
   "title_sim": 1,
   "__bib": "deul2018direct"
  }
 ],
 "presets": [
  {
   "id": "cosserat-rods-pbd-live",
   "title": "Cosserat Rods — animated elastic bend-and-twist strands under wind forcing",
   "runtime": "glsl-fragment",
   "params": {
    "P_STIFF": 0.65,
    "P_WIND": 1
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_STIFF = 0.65; // P Bend Stiffness [0.1, 1.5, 0.05]\nconst float P_WIND = 1.0; // P Wind Force [0.0, 2.2, 0.05]\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  vec3 col = mix(vec3(0.04, 0.06, 0.10), vec3(0.09, 0.12, 0.18), smoothstep(-0.5, 0.5, uv.y));\n  for (int s = 0; s < 5; s++) {\n    float fs = float(s) - 2.0;\n    vec2 prev = vec2(fs * 0.18, 0.42);\n    float minD = 9.0;\n    float twistShade = 0.0;\n    for (int k = 1; k <= 16; k++) {\n      float fk = float(k) / 16.0;\n      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);\n      vec2 cur = vec2(fs * 0.18 + sway, 0.42 - fk * 0.84);\n      vec2 pa = uv - prev, ba = cur - prev;\n      float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);\n      float segD = length(pa - ba * h);\n      if (segD < minD) { minD = segD; twistShade = 0.5 + 0.5 * sin(fk * 18.0 + iTime * 2.0 + fs); }\n      prev = cur;\n    }\n    vec3 strandCol = mix(vec3(0.28, 0.52, 0.88), vec3(0.98, 0.76, 0.34), twistShade);\n    col = mix(col, strandCol, smoothstep(0.015, 0.005, minD));\n  }\n  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-12-02",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "cosserat-rods-pbd",
     "runtime": "glsl-fragment",
     "checked_at": "2026-12-02T02:47:20.784Z",
     "execution_fidelity": "conceptual-diagram",
     "benchmark_eligible": false,
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime∈{0.0,1.5,4.0}",
     "stats": {
      "mean": 0.3725,
      "std": 0.1359,
      "unique_colors": 347,
      "nan_pixels": 0,
      "animated": true,
      "anim_delta": 0.0775
     },
     "image": "/specimens/cosserat-rods-pbd-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "xpbd",
  "strand-based-real-time-hair",
  "implicit-cloth-integration"
 ],
 "extends": [
  "xpbd"
 ],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (frontier expansion, authority-verified)",
  "sources_verified_at": "2026-12-02T02:40:24.869Z"
 },
 "solves": [],
 "authority": "Deul et al., 2018",
 "url": "https://texelatlas.vercel.app/t/cosserat-rods-pbd/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false
}