Cape and scarf as a swept field

Built on the polynomial smooth minimum by Inigo Quilez. Sources for this reference

Secondary motion is what makes a character feel alive, and it is normally a simulation with a mesh attached. In a field you do not need either. A scarf is a chain of points and the field is the union of capsules between them, which means the whole thing is a dozen segment distances.

The same strand and the same driver. Left: every node reads the motion at the same instant. Right: each node lags the one above it.

The lag is the entire effect

Left, the strand is rigid: it swings as one piece because every node is sampling the driving motion at the same moment. It reads as a painted board hanging off a shoulder.

Right, each node reads the driver slightly delayed. A movement at the top takes time to arrive at the bottom, so it travels down the strand as a wave. That one change is the difference between rigid and cloth, and it costs a subtraction:

float lag = float(i) * 0.16;              // further down = more delay
vec2 target = driverAt(t - lag);          // read the PAST, not the present

You can do this properly with springs and get better behavior under sudden stops. But sampling a delayed driver is stateless, deterministic, seekable to any time, and close enough that most viewers will never ask.

Taper the sweep, not just the chain

A constant sweep radius reads as rope. Cloth is wider where it attaches and thinner at the free end, so interpolate the capsule radius along the strand. Blend the segments with smin at a radius proportional to the local thickness, for the same reason limbs need it: a constant blend drowns the thin end.

Why this beats a simulation here

It is seekable. A cutscene needs to be renderable at any time value, in any order, identically on every run, and a stateful simulation is exactly the wrong shape for that: it has to be stepped from the beginning and it drifts with frame rate. A closed-form strand is a pure function of time.

The honest limits: it does not collide with anything, it cannot be pushed, and it will happily pass through the body it is attached to. For a strand trailing behind a figure that is usually invisible. For a cape that wraps and folds around a torso it is not, and that genuinely wants a simulation.

Rules of thumb

  1. Delay per node, not distance per node. Lag is what reads as cloth.
  2. Taper the sweep radius, and scale the blend radius with it.
  3. Keep it a pure function of time so a cutscene can seek.
  4. More nodes buys smoothness, not better behavior. Twelve is usually plenty.
  5. If it has to collide or wrap, stop and use a real solver. This technique has a ceiling and that is where it is.

All 61 notes How to use them Credits