dendenxu / torchxpbd

Based on the StVk Garment model, we develop an cloth simulation toy example using pytorch.
10 stars 1 forks source link

Extended Position Based Dynamics in PyTorch

Based on the StVk Garment model, we develop an cloth simulation toy example using pytorch.

XPBD + StVK + Bend Simulation.gif

Installation

This project is python and pytorch based and we've only tested it on ubuntu. Install dependecies with pip install -r requirements.txt

Usage

python simulate_loss_stvk_bend.py # will output tshirt-drop#loss.npz
python simulate_global_stvk_bend.py # will output tshirt-drop#global.npz
python simulate_dynamic_stvk_bend.py # will output tshirt-drop#dynamic.npz

python visualize_open3d_animation.py "tshirt-drop#loss.npz" 10  # will render the stvk loss simulation in 10 fps (in terms of simulation) (6 times slower)
python visualize_open3d_animation.py "tshirt-drop#global.npz" 10  # will render the global xpbd simulation in 10 fps (in terms of simulation) (6 times slower)
python visualize_open3d_animation.py "tshirt-drop#dynamic.npz" 10  # will render the dynamic xpbd + loss simulation in 10 fps (in terms of simulation) (6 times slower)