The LabCLOTH & SOFT BODIES SCIENCE

SHAPE FROM TINY CONSTRAINTS

Dots and links.
That’s all cloth is.

A sheet of 165 particles joined by 584 links. Gravity and wind push the particles. A solver keeps nudging every link back to its length. Pin it, pull it, cut it, drop it on a ball.

LARGEST STRETCH0.00 %Longest link vs its rest length
AVERAGE STRETCH0.00 %Across all links
TOP-EDGE SAG0.00Below the line between pins
MOTION0.00 u/sAverage particle speed
PINS2Particles that cannot move
LINKS584165 particles

01 / THE SHEET IN 3D

Pull it. Cut it.

Drag cloth to pull · drag space to orbit · scroll to zoom

02 / CONSTRAINT MAP

Every link, laid flat.

Drawn to scale in model units. Each line is one link, coloured by how far it is from its rest length. Hover a link to read it; drag a dot to pull it.

01 Forces
9.8
1.0

Pushes every free particle toward +z, gusting with time and position.

02 Material & ball
0.90

Share of each link’s error fixed on every solver pass. 1 fixes it fully.

0.55
03 Structure & pins

Changing this starts a new run.

Pins

A pinned particle has zero inverse mass: the solver never moves it.

0.00
HOW STRETCHED ARE THE LINKS?√ scale
STRETCH OVER TIMELargest Average

WHAT’S HAPPENING

Predict, then correct.

TRY THIS

Three things to make happen.

    How the model works

    The sheet is 165 particles on a 15 × 11 grid, 0.2 units apart. Each neighbouring pair is joined by a link (a distance constraint) with a rest length: across, down, and both diagonals of every square, 584 links in all. The diagonals stop the squares folding flat into diamonds (shear).

    Every 1/120 s of model time the model does two things. 1. Predict. Each free particle keeps moving the way it was moving, minus a little damping, and gravity and wind are added: xnew = x + (x − xprev)·0.994 + a·Δt². This is Verlet integration: velocity is never stored, it is the gap between the last two positions. 2. Correct. The solver then visits every link 8 times. For a link that is too long or too short it moves both ends along the link by (length − rest) × stiffness, shared out by inverse mass. A pinned particle has inverse mass zero, so its neighbour takes the whole correction. After each pass, particles inside the ball are pushed out to its surface and nothing may go below the floor.

    This is position-based dynamics. Links are not springs: there is no spring constant. Stretch is whatever error is left after 8 passes. More load, a lower stiffness or a longer chain of links all leave more of it.

    Wind is an acceleration toward +z of wind × (0.6 + 0.4·sin(2t + x)), so it gusts across the sheet. Sag on the readout is the distance from the straight line between the two corner pins down to the lowest particle on the top edge. Volume (soft block) splits each of the 64 small cubes into six tetrahedra and adds up their volumes. Motion is the average of |x − xprev| ÷ Δt.

    Grab pins the particle you hold to your pointer for as long as you hold it, then lets it go. Dragging a pin moves its anchor. Cut removes every link your stroke crosses on screen, then every face that has lost an edge, which is what the model’s own seam cut does.

    Honest limits
    • Units are model units, not metres, and stiffness is a solver setting, not a measured fabric property. The same stiffness feels stiffer with more solver passes or smaller time steps.
    • The ball and the floor have no friction. Cloth slides off the ball, and a sheet that lands while moving sideways keeps sliding across the floor until damping stops it.
    • No self-collision: the cloth can pass through itself. No bending stiffness: it folds as easily as paper towel. Cuts are instant and clean; there is no tearing under load.
    • The soft block has no volume constraint. Squash it and its volume really changes, unlike rubber or jelly, which keep their volume.
    • Wind is a uniform push that ignores the sheet’s angle and shelter. Real wind presses harder on a surface that faces it and flows around edges.
    • When the ball is switched on at the start, it overlaps the hanging sheet, so the first solver pass pushes those particles out sharply. The drop question starts the sheet flat above the ball instead.
    • With the right-hand pins shifted, a grabbed particle held just right of centre (between 0 and the shift) cannot be placed exactly. It sits as close as the model allows.
    • The 3D drawing shows wires above the pins and a hem on the fabric for looks only. They do not affect the model.
    Sources & further reading

      The model notes are in RESEARCH.md. Related labs: Chain Reaction Builder and Motion Design Playground.