{
 "id": "discrete-elastic-rods",
 "title": "Discrete elastic rods (hair and rope simulation)",
 "aliases": [
  "DER",
  "Cosserat rods",
  "elastic rod model"
 ],
 "domain": "simulation",
 "subdomain": "rods & hair",
 "stage": "simulation",
 "realtime": "interactive",
 "platforms": [
  "cpu",
  "cuda",
  "houdini",
  "python"
 ],
 "year_introduced": 2008,
 "inputs": [
  "curves"
 ],
 "outputs": [
  "curves",
  "animation"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "Treat hair, rope or cable as a chain of edges with a material frame per edge; bending and twisting energies come from curvature and twist of the discrete curve, giving physically meaningful stiffness.",
 "how_it_works": "A rod is a polyline of vertices with an orthonormal material frame attached to every edge. The state is vertex positions plus one twist angle per edge. Energies are written discretely: stretching from edge length, bending from the curvature binormal at each interior vertex computed in the two adjacent material frames, and twisting from the change in angle between consecutive frames after a parallel transport of the reference frame along the curve. Because the reference frame is propagated by parallel transport (the idea behind `rotation-minimizing-frames`), twist is measured as a scalar, avoiding frame singularities. Forces and Hessians follow by differentiating the energies; the system is integrated with implicit Euler or a variational scheme, and Newton iterations on a banded system keep the cost linear in segment count. Collisions, friction and contact with a body are handled with penalty or constraint terms around this core.",
 "when_to_use": "Choose it when physical fidelity of thin elastic structures matters: hair curls, coiling ropes, cables, sutures and sweaters at offline or interactive rates, where bending and twist stiffness have to be real material parameters. Prefer `verlet-integration-constraints` or `xpbd` strands when stability, speed and artistic control matter more than physical units, and `position-based-dynamics` for large hair counts in games. Prefer `implicit-cloth-integration` for two-dimensional sheets.",
 "cost": {
  "class": "offline",
  "notes": "Linear per rod with implicit integration, but production hair counts and contact handling keep it offline or interactive-only."
 },
 "failure_modes": [
  "Stiff systems need implicit integration; explicit steps explode at realistic bending stiffness",
  "Frame twisting near straight segments loses the reference frame if parallel transport is not handled with care",
  "Self-collision between strands is expensive and often left to a separate contact model",
  "Newton solves can fail to converge at large timesteps or under strong contact",
  "Per-edge frames add state that game engines rarely store, complicating export"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/1360612.1360662",
   "type": "paper",
   "title": "Discrete elastic rods",
   "authors": [
    "Miklós Bergou",
    "Max Wardetzky",
    "Stephen Robinson",
    "Basile Audoly",
    "Eitan Grinspun"
   ],
   "year": 2008,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/1360612.1360662",
   "ids": {
    "doi": "10.1145/1360612.1360662"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1360612.1360662",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1360612.1360662",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1360612.1360662",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1360612.1360662",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1360612.1360662",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "bergou2008discrete"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/1778765.1778853",
   "type": "paper",
   "title": "Discrete viscous threads",
   "authors": [
    "Miklós Bergou",
    "Basile Audoly",
    "Etienne Vouga",
    "Max Wardetzky",
    "Eitan Grinspun"
   ],
   "year": 2010,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/1778765.1778853",
   "ids": {
    "doi": "10.1145/1778765.1778853"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1778765.1778853",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1778765.1778853",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1778765.1778853",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1778765.1778853",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1778765.1778853",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "bergou2010discrete"
  },
  {
   "role": "tutorial",
   "key": "url:https://www.cs.columbia.edu/cg/rods",
   "type": "tutorial",
   "title": "Discrete Elastic Rods project page (Columbia Computer Graphics Group)",
   "authors": [
    "Bergou",
    "Wardetzky",
    "Robinson",
    "Audoly",
    "Grinspun"
   ],
   "year": null,
   "venue": "cs.columbia.edu",
   "url": "http://www.cs.columbia.edu/cg/rods",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260927042222/https://www.cs.columbia.edu/cg/rods/",
     "timestamp": "20260927042222"
    },
    "page_title": "Discrete Elastic Rods",
    "host": "cs.columbia.edu",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://www.cs.columbia.edu/cg/rods → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.cs.columbia.edu/cg/rods → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://www.cs.columbia.edu/cg/rods → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0.95,
   "__bib": "bergoudiscrete"
  },
  {
   "role": "implementation",
   "key": "gh:jpanetta/elasticrods",
   "type": "code",
   "title": "jpanetta/ElasticRods",
   "description": "Elastic Rod and X-Shell Simulation",
   "authors": [
    "jpanetta"
   ],
   "year": 2019,
   "venue": "GitHub",
   "url": "https://github.com/jpanetta/ElasticRods",
   "ids": {
    "repo": "jpanetta/ElasticRods"
   },
   "license": "MIT",
   "extra": {
    "stars": 51,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2024-02-04T01:54:23Z",
    "language": "Jupyter Notebook",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/jpanetta/ElasticRods",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "jpanetta2019jpanetta"
  }
 ],
 "presets": [
  {
   "id": "discrete-elastic-rods-live",
   "title": "Discrete elastic rods — 3D Bishop-frame twisted helices, material-frame twist stripes & bend energy",
   "runtime": "glsl-fragment",
   "params": {
    "P_TWIST_RATE": 3.2,
    "P_BEND_AMP": 0.42,
    "P_ROD_RADIUS": 0.085,
    "P_ANIM_SPEED": 1
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_TWIST_RATE = 3.2; // P Material Twist [0.5, 7.0, 0.1]\nconst float P_BEND_AMP = 0.42; // P Helical Buckling [0.1, 0.75, 0.02]\nconst float P_ROD_RADIUS = 0.085; // P Rod Thickness [0.04, 0.14, 0.005]\nconst float P_ANIM_SPEED = 1.0; // P Wave Speed [0.0, 2.5, 0.05]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\n// Centerline of a buckled elastic rod parametrized by arc parameter s in [-1.4, 1.4]\nvec3 rodCenter(float s, float rodId, float t, float bendAmp) {\n  float ph = rodId * 2.094395 + t * 0.85;\n  // Buckling envelope strongest in middle, clamped at endpoints\n  float env = cos(clamp(s * 0.95, -1.5708, 1.5708));\n  float rHelix = bendAmp * (0.35 + 0.65 * env * env);\n  float freq = 3.2 + 0.45 * sin(t * 0.5 + rodId);\n  return vec3(\n    s * 0.92,\n    rHelix * cos(s * freq + ph),\n    rHelix * sin(s * freq + ph)\n  );\n}\n\n// Evaluate distance to 3 intertwined elastic rods + return (dist, rodId, arcS, frameAngle)\nvec4 mapRods(vec3 p, float t, float bendAmp, float rodRad) {\n  vec3 q = p;\n  q.xz = rot2(t * 0.25) * q.xz;\n  q.yz = rot2(0.28) * q.yz;\n\n  float bestD = 1e5;\n  float bestId = 0.0;\n  float bestS = 0.0;\n  float bestPhi = 0.0;\n\n  for (int r = 0; r < 3; r++) {\n    float fr = float(r);\n    // Approximate nearest arc-length parameter s via 2-step Newton projection from q.x\n    float s = clamp(q.x / 0.92, -1.35, 1.35);\n    for (int k = 0; k < 2; k++) {\n      vec3 c0 = rodCenter(s, fr, t, bendAmp);\n      vec3 c1 = rodCenter(s + 0.015, fr, t, bendAmp);\n      vec3 tang = normalize(c1 - c0);\n      float ds = dot(q - c0, tang) * 0.62;\n      s = clamp(s + ds, -1.35, 1.35);\n    }\n    vec3 c = rodCenter(s, fr, t, bendAmp);\n    vec3 cNext = rodCenter(s + 0.02, fr, t, bendAmp);\n    vec3 T = normalize(cNext - c);\n    // Parallel-transported Bishop reference frame (U, V) orthogonal to tangent T\n    vec3 upRef = vec3(0.0, 1.0, 0.0);\n    vec3 U = normalize(cross(T, upRef) + vec3(0.0, 0.0, 1e-4));\n    vec3 V = cross(T, U);\n    vec3 rel = q - c;\n    float d = length(rel) - rodRad;\n    if (d < bestD) {\n      bestD = d;\n      bestId = fr;\n      bestS = s;\n      bestPhi = atan(dot(rel, V), dot(rel, U));\n    }\n  }\n  return vec4(bestD * 0.78, bestId, bestS, bestPhi);\n}\n\nvec3 calcNormal(vec3 p, float t, float bendAmp, float rodRad) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapRods(p + e.xyy, t, bendAmp, rodRad).x - mapRods(p - e.xyy, t, bendAmp, rodRad).x,\n    mapRods(p + e.yxy, t, bendAmp, rodRad).x - mapRods(p - e.yxy, t, bendAmp, rodRad).x,\n    mapRods(p + e.yyx, t, bendAmp, rodRad).x - mapRods(p - e.yyx, t, bendAmp, rodRad).x\n  ));\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float tAnim = iTime * max(P_ANIM_SPEED, 0.0);\n  float twist = clamp(P_TWIST_RATE, 0.2, 8.0);\n  float bendAmp = clamp(P_BEND_AMP, 0.08, 0.85);\n  float rodRad = clamp(P_ROD_RADIUS, 0.035, 0.16);\n\n  vec3 ro = vec3(0.0, 0.08, 2.55);\n  vec3 rd = normalize(vec3(uv, -1.55));\n\n  // Studio slate background\n  vec3 col = mix(vec3(0.03, 0.04, 0.068), vec3(0.09, 0.115, 0.165), smoothstep(-0.55, 0.55, uv.y));\n  vec2 bgG = abs(fract(uv * 10.0 - 0.5) - 0.5);\n  col += vec3(0.018, 0.028, 0.045) * smoothstep(0.03, 0.0, min(bgG.x, bgG.y));\n\n  float t = 0.0;\n  vec4 hitRes = vec4(0.0);\n  bool hit = false;\n  for (int i = 0; i < 68; i++) {\n    vec4 h = mapRods(ro + rd * t, tAnim, bendAmp, rodRad);\n    if (h.x < 0.002) { hit = true; hitRes = h; break; }\n    t += h.x;\n    if (t > 8.5) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, tAnim, bendAmp, rodRad);\n    float rodId = hitRes.y;\n    float s = hitRes.z;\n    float phi = hitRes.w;\n\n    // Material frame angle theta(s) rotates relative to the twist-free Bishop frame!\n    float matAngle = phi - s * twist * 2.2 - tAnim * 1.4;\n    float twistStripe = smoothstep(-0.12, 0.12, sin(matAngle * 2.0));\n    // Discrete vertex segment rings along the elastic rod polyline\n    float segRing = smoothstep(0.075, 0.015, abs(fract(s * 6.5) - 0.5));\n\n    // Curvature energy glow highest near high-buckling midspan\n    float bendEnergy = cos(clamp(s * 0.95, -1.5708, 1.5708));\n    bendEnergy = bendEnergy * bendEnergy * clamp(bendAmp * 1.8, 0.0, 1.0);\n\n    vec3 baseA, baseB;\n    if (rodId < 0.5) {\n      baseA = vec3(0.16, 0.62, 0.92); baseB = vec3(0.96, 0.82, 0.32);\n    } else if (rodId < 1.5) {\n      baseA = vec3(0.92, 0.34, 0.28); baseB = vec3(0.96, 0.92, 0.86);\n    } else {\n      baseA = vec3(0.18, 0.82, 0.58); baseB = vec3(0.14, 0.24, 0.38);\n    }\n\n    vec3 alb = mix(baseA, baseB, twistStripe);\n    alb = mix(alb, vec3(0.06, 0.08, 0.12), segRing * 0.45);\n\n    vec3 l1 = normalize(vec3(0.62, 0.85, 0.58));\n    vec3 l2 = normalize(vec3(-0.75, -0.22, 0.52));\n    float diff1 = max(dot(n, l1), 0.0);\n    float diff2 = max(dot(n, l2), 0.0);\n    vec3 hVec = normalize(l1 - rd);\n    float spec = pow(max(dot(n, hVec), 0.0), 46.0) * 0.65;\n    float rim = pow(1.0 - max(dot(n, -rd), 0.0), 2.8) * 0.38;\n\n    col = alb * (0.24 + 0.86 * diff1 + 0.25 * diff2) + vec3(spec) + vec3(0.55, 0.78, 1.0) * rim;\n    col += vec3(1.0, 0.52, 0.18) * bendEnergy * 0.16;\n  }\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "discrete-elastic-rods",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:04:28.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.505,
      "std": 0.2323,
      "min": 0.2063,
      "max": 0.9496
     },
     "image": "/specimens/discrete-elastic-rods-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "verlet-integration-constraints",
  "xpbd",
  "position-based-dynamics",
  "rotation-minimizing-frames",
  "implicit-cloth-integration"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "rotation-minimizing-frames",
   "why": "Parallel-transported reference frames along the rod give the twist measure the elastic energy needs."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/simulation/discrete-elastic-rods.json"
 },
 "solves": [
  "hair or rope needs real bending and twist stiffness",
  "curly strands coil naturally and hold their shape",
  "cable simulation with physically meaningful material parameters",
  "thin elastic strands blow up under stiff explicit integration"
 ],
 "authority": "Bergou et al., 2008",
 "url": "https://texelatlas.vercel.app/t/discrete-elastic-rods/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 161.22,
  "tier": "extreme",
  "p50_ms": 5.0622,
  "p95_ms": 5.202,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "discrete-elastic-rods-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 147.99,
   "tier": "extreme",
   "p50_ms": 2.3383,
   "p95_ms": 2.4228,
   "speedup_x": 2.16,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 106.68,
   "tier": "extreme",
   "p50_ms": 3.0725,
   "p95_ms": 3.1624,
   "speedup_x": 1.65,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}