Cloth Simulation

A GPU-accelerated cloth simulation.

Simulated cloth reacts to wind and collisions in real-time.

Key Features

  • GPU-accelerated cloth simulation
  • Air resistance / wind interaction
  • Collision handling
  • Self-collision handling

Description

This was my submission for a class project in CSCI 5611: Animation & Planning in Games. The goal of this project was to create a realistic cloth simulation by building off of the underlying physical model that defines cloth's behavior. I expanded on this by parallelizing my simulation and running it on the GPU using compute shaders, allowing for higher density cloth and even real-time cloth self-collisions to be simulated.

The cloth was modeled using a 2D mass-spring chain consisting of structural, shear, and bending spring connections between nodes. Each node is simulated using Hooke's law, with additional damping from an air-resistance factor, as well as wind effects introduced by taking into account the facing direction of each node based on the triangles it is a part of.

Demo

Cloth simulation with air drag in varying wind conditions.
Comparison between cloth simulation with air drag (left) and without (right).
Utilizing GPU compute shaders allows for real-time cloth self-collision.
With the right shader applied, the cloth almost looks like water...

Tools Used

Languages: C#, HLSL

Software: Unity