How Physics Engines Simulate Cloth
Points, Constraints, and Verlet Integration
Points, Constraints, and Verlet Integration
Cloth in a physics engine isn't a solid surface. It's a grid of tiny point masses, each one a particle with a position and the pull of gravity. On their own, they just fall.
Each particle stores just two things: its current position and its previous position. That's it. No explicit velocity variable needed. The difference between the two positions is the velocity.
Now connect neighboring particles with distance constraints: rigid rods that try to maintain a fixed length. If two points drift apart, the constraint pulls them back. If they overlap, it pushes them apart. Click the buttons to see the difference.
Think of each constraint as a stiff spring with zero elasticity. It doesn't bounce or oscillate. Every frame, it just says: "We should be this far apart" and nudges both particles to make it so.
The math that moves each particle forward in time is called Verlet integration. It's elegant: the new position is computed from the current position, the previous position, and acceleration (gravity). Velocity is never stored directly.
Click and drag the cloth to interact with it
One pass of constraint solving isn't enough. Each constraint fix can violate a neighbor's constraint. More iterations per frame means stiffer, more stable cloth. Try sliding from 1 to 12 and watch the difference.
Real cloth hangs from something. Pinned points are particles that skip the physics update entirely. They stay fixed in place while everything else swings freely beneath them. Click any particle on the top row to pin or unpin it.
Click top-row particles to toggle pins. Drag the cloth to interact.
In a game, pinned points often follow an animated character. A cape's top edge is pinned to the hero's shoulders. As the character runs, those anchor points move, and the rest of the cloth reacts naturally through the physics simulation.
Wind is an external force applied to each particle, just like gravity but sideways. Real wind isn't constant, so engines add turbulence: random noise layered on top of a base direction. The result is cloth that billows and flutters naturally.
Drag the cloth while wind blows for a combined effect
Wind force on a triangle of cloth depends on the triangle's surface normal (which way it faces). A panel facing directly into the wind catches the full force. One turned edge-on feels almost nothing. This is why cloth twists and curls realistically in wind.
If a constraint stretches beyond a tear threshold, it breaks permanently. The two particles it connected are no longer linked, and the cloth rips open. Drag aggressively to tear the cloth apart.
Grab and pull hard to tear the cloth. Lower threshold = easier to rip.
Tearable cloth is used everywhere: battle damage on character clothing, paper tearing in puzzle games, destructible sails on pirate ships. The threshold controls how tough the material is. Silk tears easily. Canvas holds firm.
You now understand how physics engines turn a grid of points and simple distance rules into realistic cloth. The same technique powers flags, capes, curtains, and soft bodies in games and movies.
Cloth is modeled as a grid of particles, each with a position and previous position.
Velocity is implicit: new position = current + (current - previous) + acceleration.
Stiff rods between neighbors keep the cloth from flying apart.
Solving constraints multiple times per frame makes cloth stiffer and more stable.
When a constraint stretches past a threshold, it breaks, and the cloth rips.
Put your new knowledge into practice!