Cloth Physics Simulator
Interactive cloth simulation using mass-spring system with Verlet integration
About this Simulator
This simulator demonstrates cloth physics using a mass-spring particle system with Verlet integration. Watch how fabric drapes over a box, responding to gravity and wind. Adjust stiffness to simulate different materials from silk to canvas.
Physics & Formulas
Verlet Integration:
$$x_{new} = x_{current} + (x_{current} - x_{previous}) \cdot damping + a \cdot dt^2$$
Spring Constraint:
$$\Delta x = \frac{(|p_2 - p_1| - L_0)}{|p_2 - p_1|} \cdot 0.5 \cdot (p_2 - p_1)$$
Where: x = position, a = acceleration, dt = timestep, L0 = rest length
How to Use
- Click 'Drop Cloth' to release the fabric onto the box
- Adjust Stiffness: Low = stretchy silk, High = rigid canvas
- Increase Gravity to make the cloth fall faster
- Add Wind to push the cloth sideways
- Damping controls how quickly motion settles
- Toggle Wireframe to see the spring network
Frequently Asked Questions
What is Verlet integration?
Verlet integration is a numerical method that calculates new positions using current and previous positions, without explicitly tracking velocity. It's very stable for cloth simulation because constraints are easier to enforce.
Why use a mass-spring system?
Mass-spring systems model cloth as particles connected by springs. Structural springs prevent stretching, shear springs prevent skewing, and bend springs prevent sharp folding. This creates realistic fabric behavior.
How does collision detection work?
Each particle is checked against the box boundaries. If a particle penetrates the box, it's pushed back to the surface. This simple approach works well for convex objects like boxes.
What affects cloth behavior most?
Stiffness determines how much the cloth stretches. High stiffness = rigid fabric like denim. Low stiffness = stretchy fabric like jersey. Damping affects how quickly the cloth settles after motion.