---
id: "discrete-elastic-rods"
title: "Discrete elastic rods (hair and rope simulation)"
aliases: [DER, Cosserat rods, elastic rod model]
domain: "simulation"
stage: "simulation"
realtime: "interactive"
platforms: [cpu, cuda, houdini, python]
year_introduced: 2008
inputs: [curves]
outputs: [curves, animation]
style: "both"
dynamic: "dynamic"
cost: "offline"
authority: "Bergou et al., 2008"
url: "https://texelatlas.vercel.app/t/discrete-elastic-rods/"
sources_verified_at: "2026-11-29"
---
# Discrete elastic rods (hair and rope simulation) (Bergou et al., 2008)

> 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.

## Reach for it when

- 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

## 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](https://texelatlas.vercel.app/t/rotation-minimizing-frames.md)), 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 it

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 with relaxation constraints](https://texelatlas.vercel.app/t/verlet-integration-constraints.md) or [Extended Position-Based Dynamics](https://texelatlas.vercel.app/t/xpbd.md) strands when stability, speed and artistic control matter more than physical units, and [Position Based Dynamics](https://texelatlas.vercel.app/t/position-based-dynamics.md) for large hair counts in games. Prefer [Implicit cloth integration (Baraff-Witkin)](https://texelatlas.vercel.app/t/implicit-cloth-integration.md) for two-dimensional sheets.

## Cost

offline — Linear per rod with implicit integration, but production hair counts and contact handling keep it offline or interactive-only.
Measured GPU Weight: 161.22× baseline (extreme) — 5.0622 ms median / 5.202 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 147.99× baseline (extreme) — 2.3383 ms median (2.16× faster on L4).
Ampere A100 scaling: 106.68× baseline (extreme) — 3.0725 ms median (1.65× faster on A100).

## 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

## Dataflow

- Inputs: curves
- Outputs: curves, animation
- Platforms: cpu, cuda, houdini, python

## Presets

### Discrete elastic rods — 3D Bishop-frame twisted helices, material-frame twist stripes & bend energy (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_TWIST_RATE": 3.2,
  "P_BEND_AMP": 0.42,
  "P_ROD_RADIUS": 0.085,
  "P_ANIM_SPEED": 1
}
```

```glsl
const float P_TWIST_RATE = 3.2; // P Material Twist [0.5, 7.0, 0.1]
const float P_BEND_AMP = 0.42; // P Helical Buckling [0.1, 0.75, 0.02]
const float P_ROD_RADIUS = 0.085; // P Rod Thickness [0.04, 0.14, 0.005]
const float P_ANIM_SPEED = 1.0; // P Wave Speed [0.0, 2.5, 0.05]

mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

// Centerline of a buckled elastic rod parametrized by arc parameter s in [-1.4, 1.4]
vec3 rodCenter(float s, float rodId, float t, float bendAmp) {
  float ph = rodId * 2.094395 + t * 0.85;
  // Buckling envelope strongest in middle, clamped at endpoints
  float env = cos(clamp(s * 0.95, -1.5708, 1.5708));
  float rHelix = bendAmp * (0.35 + 0.65 * env * env);
  float freq = 3.2 + 0.45 * sin(t * 0.5 + rodId);
  return vec3(
    s * 0.92,
    rHelix * cos(s * freq + ph),
    rHelix * sin(s * freq + ph)
  );
}

// Evaluate distance to 3 intertwined elastic rods + return (dist, rodId, arcS, frameAngle)
vec4 mapRods(vec3 p, float t, float bendAmp, float rodRad) {
  vec3 q = p;
  q.xz = rot2(t * 0.25) * q.xz;
  q.yz = rot2(0.28) * q.yz;

  float bestD = 1e5;
  float bestId = 0.0;
  float bestS = 0.0;
  float bestPhi = 0.0;

  for (int r = 0; r < 3; r++) {
    float fr = float(r);
    // Approximate nearest arc-length parameter s via 2-step Newton projection from q.x
    float s = clamp(q.x / 0.92, -1.35, 1.35);
    for (int k = 0; k < 2; k++) {
      vec3 c0 = rodCenter(s, fr, t, bendAmp);
      vec3 c1 = rodCenter(s + 0.015, fr, t, bendAmp);
      vec3 tang = normalize(c1 - c0);
      float ds = dot(q - c0, tang) * 0.62;
      s = clamp(s + ds, -1.35, 1.35);
    }
    vec3 c = rodCenter(s, fr, t, bendAmp);
    vec3 cNext = rodCenter(s + 0.02, fr, t, bendAmp);
    vec3 T = normalize(cNext - c);
    // Parallel-transported Bishop reference frame (U, V) orthogonal to tangent T
    vec3 upRef = vec3(0.0, 1.0, 0.0);
    vec3 U = normalize(cross(T, upRef) + vec3(0.0, 0.0, 1e-4));
    vec3 V = cross(T, U);
    vec3 rel = q - c;
    float d = length(rel) - rodRad;
    if (d < bestD) {
      bestD = d;
      bestId = fr;
      bestS = s;
      bestPhi = atan(dot(rel, V), dot(rel, U));
    }
  }
  return vec4(bestD * 0.78, bestId, bestS, bestPhi);
}

vec3 calcNormal(vec3 p, float t, float bendAmp, float rodRad) {
  vec2 e = vec2(0.0025, 0.0);
  return normalize(vec3(
    mapRods(p + e.xyy, t, bendAmp, rodRad).x - mapRods(p - e.xyy, t, bendAmp, rodRad).x,
    mapRods(p + e.yxy, t, bendAmp, rodRad).x - mapRods(p - e.yxy, t, bendAmp, rodRad).x,
    mapRods(p + e.yyx, t, bendAmp, rodRad).x - mapRods(p - e.yyx, t, bendAmp, rodRad).x
  ));
}

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 tAnim = iTime * max(P_ANIM_SPEED, 0.0);
  float twist = clamp(P_TWIST_RATE, 0.2, 8.0);
  float bendAmp = clamp(P_BEND_AMP, 0.08, 0.85);
  float rodRad = clamp(P_ROD_RADIUS, 0.035, 0.16);

  vec3 ro = vec3(0.0, 0.08, 2.55);
  vec3 rd = normalize(vec3(uv, -1.55));

  // Studio slate background
  vec3 col = mix(vec3(0.03, 0.04, 0.068), vec3(0.09, 0.115, 0.165), smoothstep(-0.55, 0.55, uv.y));
  vec2 bgG = abs(fract(uv * 10.0 - 0.5) - 0.5);
  col += vec3(0.018, 0.028, 0.045) * smoothstep(0.03, 0.0, min(bgG.x, bgG.y));

  float t = 0.0;
  vec4 hitRes = vec4(0.0);
  bool hit = false;
  for (int i = 0; i < 68; i++) {
    vec4 h = mapRods(ro + rd * t, tAnim, bendAmp, rodRad);
    if (h.x < 0.002) { hit = true; hitRes = h; break; }
    t += h.x;
    if (t > 8.5) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = calcNormal(p, tAnim, bendAmp, rodRad);
    float rodId = hitRes.y;
    float s = hitRes.z;
    float phi = hitRes.w;

    // Material frame angle theta(s) rotates relative to the twist-free Bishop frame!
    float matAngle = phi - s * twist * 2.2 - tAnim * 1.4;
    float twistStripe = smoothstep(-0.12, 0.12, sin(matAngle * 2.0));
    // Discrete vertex segment rings along the elastic rod polyline
    float segRing = smoothstep(0.075, 0.015, abs(fract(s * 6.5) - 0.5));

    // Curvature energy glow highest near high-buckling midspan
    float bendEnergy = cos(clamp(s * 0.95, -1.5708, 1.5708));
    bendEnergy = bendEnergy * bendEnergy * clamp(bendAmp * 1.8, 0.0, 1.0);

    vec3 baseA, baseB;
    if (rodId < 0.5) {
      baseA = vec3(0.16, 0.62, 0.92); baseB = vec3(0.96, 0.82, 0.32);
    } else if (rodId < 1.5) {
      baseA = vec3(0.92, 0.34, 0.28); baseB = vec3(0.96, 0.92, 0.86);
    } else {
      baseA = vec3(0.18, 0.82, 0.58); baseB = vec3(0.14, 0.24, 0.38);
    }

    vec3 alb = mix(baseA, baseB, twistStripe);
    alb = mix(alb, vec3(0.06, 0.08, 0.12), segRing * 0.45);

    vec3 l1 = normalize(vec3(0.62, 0.85, 0.58));
    vec3 l2 = normalize(vec3(-0.75, -0.22, 0.52));
    float diff1 = max(dot(n, l1), 0.0);
    float diff2 = max(dot(n, l2), 0.0);
    vec3 hVec = normalize(l1 - rd);
    float spec = pow(max(dot(n, hVec), 0.0), 46.0) * 0.65;
    float rim = pow(1.0 - max(dot(n, -rd), 0.0), 2.8) * 0.38;

    col = alb * (0.24 + 0.86 * diff1 + 0.25 * diff2) + vec3(spec) + vec3(0.55, 0.78, 1.0) * rim;
    col += vec3(1.0, 0.52, 0.18) * bendEnergy * 0.16;
  }

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).

## Combines with

- [Rotation-Minimizing Frames](https://texelatlas.vercel.app/t/rotation-minimizing-frames.md): Parallel-transported reference frames along the rod give the twist measure the elastic energy needs.

## Sources

1. [primary] Miklós Bergou, Max Wardetzky, Stephen Robinson, Basile Audoly, Eitan Grinspun (2008) Discrete elastic rods. ACM Transactions on Graphics. https://doi.org/10.1145/1360612.1360662 (verified via crossref on 2026-11-29)
2. [primary] Miklós Bergou, Basile Audoly, Etienne Vouga, Max Wardetzky, Eitan Grinspun (2010) Discrete viscous threads. ACM Transactions on Graphics. https://doi.org/10.1145/1778765.1778853 (verified via crossref on 2026-11-29)
3. [tutorial] Bergou, Wardetzky, Robinson, Audoly, Grinspun Discrete Elastic Rods project page (Columbia Computer Graphics Group). cs.columbia.edu. http://www.cs.columbia.edu/cg/rods (verified via http on 2026-11-29)
4. [implementation] jpanetta (2019) jpanetta/ElasticRods. https://github.com/jpanetta/ElasticRods License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Discrete elastic rods (hair and rope simulation)." https://texelatlas.vercel.app/t/discrete-elastic-rods/ (accessed 2026-12-01).
