This is a WebGPU Cloth Simulator that uses XPBD (extended position based dynamics) with small step sizes.
This relies heavily on the following papers:
- XPBD: Position-Based Simulation of Compliant Constrained Dynamics - Macklin et. al - NVIDIA
- Small Steps in Physics Simulation, Macklin et. al - NVIDIA
- A Survey on Position Based Dynamics, 2017
As well as code snippets from:
The following steps describe how to run this simulation locally.
Note - This has only been tested on Windows (specifically with WSL2).
WebGPU is currently a developmental feature, and thus requires a browser that enables access to it. Google Canary is a good candidate. To enable the correct features in your browser, please do the following:
- Enable the
#enable-unsafe-webgpu
flag in about://flags.
With yarn installed, run the following:
yarn
yarn start
- XPBD Simulation Loop
- Small Steps
- Constraints - Distance
- Constraints - Fast Performant Bending
- Constraints - Isometric Bending
- Constraints - Angular Bending
- Constraints - Collisions (Self)
- Constraints - Collisions (External)
- Damping