GPU - Cloth simulation

About Cloth simulation

The goal of this project was to create an NVIDIA CUDA kernel to make a particle-based cloth simulation using Verlet integration. We got a framework that took care of rendering the cloth and "only" had to implement the Verlet integration using CUDA kernels.

Implementation detail

The cloth is held together by three different kinds of springs called Structural, Shear and Flexion. These springs connect to certain particles and are used to calculate how the cloth should deform and move.
img not found
Launch the simulation kernel starting one thread for each particle
Update the particle positions using Verlet integration:
xt+∆t = (1+ damp)·xt − damp * xt−∆t + a∆t 2
a should contain gravity
a should also consider the current wind direction and strength given by wind_x, wind_y, wind_z
Make sure that fixed particles do not change their position
Repeatedly (fixUpIterations times) launch a kernel that enforces the spring constraints and obstacle collisions, again starting one thread per particle
For each particle iterate over all particles connected via springs and compute the movement that would be required to restore each spring into its resting position.
Based on the mass ratio between the particle pairs (and information about particles being fixed) compute the part of the movement that would have to be carried out by the current particle
Sum these movements up and update the particle position with a fraction of that movement (fixUpPercent of the full movement)
Iterate over all spherical obstacles and determine if the particle’s updated position would be inside any of them. If that is the case move the particle out of the sphere (along the sphere normal)

Contact me

Please reach me at if you want to get in touch.