The Lab
Original — built for the Lab

Silk

This sheet of silk is 2,440 points and 14,137 rules, each of which says only “stay this far from that one”. Nothing in the program describes fabric, yet it hangs in folds, fills with wind, wraps a sphere and rips the way cloth rips. Pull hard enough and the rules start breaking one at a time, and the counters show how many are gone.

PhysicsVerlet integrationConstraintsWebGL2Simulation
After Thomas Jakobsen's “Advanced Character Physics” (Game Developers Conference, 2001), the method behind the cloth and ragdolls of Hitman: Codename 47
Loading demo…

Before 2001, game characters mostly died stiffly, and their capes did not move at all. Physics engines worked with forces, velocities and springs, and anything soft and floppy needed tiny time steps or it went unstable. Thomas Jakobsen, working on Hitman: Codename 47 at IO Interactive, published a much blunter method. Forget velocity: remember where each point is and where it was a moment ago, let it carry on, and then simply move the points back to the right distances from each other. Do that a few times and accept whatever comes out.

What comes out is cloth. The sheet here is a grid of points joined three ways: to each neighbour, across each diagonal so it resists shearing, and to the point two along so it resists folding too sharply. Every frame, gravity and the wind push the points a little, and then the program walks through all fourteen thousand joins a dozen times, nudging each pair back toward its length. It never finds the exact answer. It does not need to, because an approximate answer that looks right sixty times a second is what a viewer sees.

The surprise is how much behaviour appears that nobody wrote. Pinch pleats form between the rings because the rail is shorter than the cloth. A gust shapes the sheet into a sail because the wind pushes on each small square according to how squarely it faces into the wind. A rip runs because once one join snaps, its neighbours take its load and snap in turn. Turn the stiffness down to two passes and the silk goes stretchy, like jersey; turn it up and the same points behave like canvas. One number, the number of passes, changes the fabric.

Versions of the same trick still run in games, film effects and the cloth tools fashion designers use to drape garments before anything is sewn. Sixteen years after Jakobsen, Müller, Macklin and colleagues turned it into position-based dynamics, used across much of the games industry. The leash that keeps this curtain from sagging out of shape, a long-range attachment from each point to its nearest pin, comes from that line of work too.

Next in the Lab
The Golden AngleOpen

A sunflower is one number. Turn it by a tenth of a degree and the seeds collapse into spokes.