How Physics Engines Simulate Cloth

Points, Constraints, and Verlet Integration

1

A Grid of Particles

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.

💡 Key Idea

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.

2

Connecting Points with Constraints

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.

correction = (distance - restLength) / distance
Move each point by half the correction toward the other
🌟 Why "Distance Constraints"?

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.

3

Verlet Integration: The Engine

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.

nextPos = currentPos + (currentPos - prevPos) + acceleration * dt²
1.0
5

Click and drag the cloth to interact with it

💡 Why Iterations Matter

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.

4

Pinning: Anchoring the Cloth

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 Games

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.

5

Adding Wind

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.

0.8
0.4

Drag the cloth while wind blows for a combined effect

💡 How Wind Works on Cloth

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.

6

Tearing: When Cloth Breaks

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.

1.8x

Grab and pull hard to tear the cloth. Lower threshold = easier to rip.

0
Constraints Broken
0
Constraints Remaining
🎬 In Film & Games

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.

Cloth Physicist!

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.

0
Interactions
0
Time Exploring

Point Masses

Cloth is modeled as a grid of particles, each with a position and previous position.

Verlet Integration

Velocity is implicit: new position = current + (current - previous) + acceleration.

Distance Constraints

Stiff rods between neighbors keep the cloth from flying apart.

Constraint Iterations

Solving constraints multiple times per frame makes cloth stiffer and more stable.

Tearing

When a constraint stretches past a threshold, it breaks, and the cloth rips.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction