Computer graphics · UW CSE 457 final artifact

Cloth Simulation

A real-time mass–spring cloth solver built in Unity, combining stable integration, stretch constraints, configurable pinning, collision response, and interactive wind.

Interactive wind: sail scene with real-time direction and strength controls.

The solver

From particles to fabric.

I modeled the cloth as a grid of particles connected by three spring families. Structural springs resist stretching, shear springs stabilize diagonal deformation, and flexion springs resist bending.

Each frame accumulates spring and global forces, advances non-fixed particles with Verlet integration, resolves collisions and overextension constraints, and writes the corrected positions back to the rendered mesh.

Fixed-point rules support several pinning configurations. The loop also integrates the project’s collision and surface-aware wind utilities, including turbulent gusts and real-time direction and strength controls.

Built with
Unity / C#
Core model
Mass–spring particle system
Integration
Verlet integration
Response
Constraints / collisions / wind

Implementation

Five systems

01

Mass–spring topology

Structural springs for stretch resistance, shear springs for diagonal stability, and flexion springs for bending resistance across the particle grid.

02

Hooke’s-law forces

Spring forces pull particles together when stretched and push them apart when compressed, using rest length, stiffness, and spring direction.

03

Stable motion and constraints

Verlet integration plus an overextension constraint that corrects springs before unrealistic stretching destabilizes the cloth.

04

Three-phase physics loop

Per-frame pipeline: force accumulation, integration and collision handling, constraint resolution, then mesh-vertex updates.

05

Configurable test scenes

Fixed-point detection for multiple pinning patterns, with the provided collision and wind helpers integrated into the simulation loop.

Simulation scenes

One solver. Four stress tests.