DiffCloth
我们论文DiffCloth: 具有干摩擦接触的可微分布模拟的代码仓库
测试过的操作系统
Ubuntu 22.04 | Mac OS 12
1. 下载仓库:
请确保使用--recursive
选项以安装依赖项
git clone --recursive https://github.com/omegaiota/DiffCloth.git
2. 使用Cmake构建CPP代码:
在顶级目录中:
mkdir build
cd build
cmake ..
make
3. 优化/可视化第6节实验:
-
运行优化:
./DiffCloth -demo {演示选项} -mode optimize -seed {随机种子}
其中
{演示选项}
是以下选项中的演示名称,{随机种子}
是一个整数,用于任务初始猜测的随机初始化。每个实验对应的选项是:
- 6.1 T恤:
tshirt
- 6.1 球体:
sphere
- 6.2 帽子:
hat
- 6.2 袜子:
sock
- 6.3 连衣裙:
dress
- 6.1 T恤:
-
可视化优化迭代:
./DiffCloth -demo {演示选项} -mode visualize -exp {实验名称}
其中
{实验名称}
是要可视化的迭代文件夹。代码仓库中包含了一个T恤的示例优化运行,位于output/tshirt-exampleopt/
,你可以通过以下命令可视化第一次迭代:./DiffCloth -demo tshirt -mode visualize -exp tshirt-exampleopt/iter0/
优化的进度会保存在根文件夹的output/
目录中。中间进度使用自定义的OpenGL查看器进行可视化。
4. 构建Python绑定并运行帽子控制器示例:
构建Python绑定:
- 安装Anaconda以创建虚拟环境。
- 在项目根文件夹中,运行
python setup.py install
以安装Python绑定包。如果修改了CPP代码,请重新运行此命令。 - 创建conda虚拟环境:
conda env create python=3.8 --file environment.yml
,然后通过conda activate diffcloth
激活它
训练/测试帽子控制器示例:
- 导航到
src/python_code
- 测试预训练网络: 运行
python hatController.py --eval --render --load_expname 20210809-trainedBest
- 训练网络: 运行
python hatController.py --render
- 恢复训练: 运行
python hatController.py --train_resume --load_expname [实验名称] --load_epoch [轮数]
模拟结果会保存到根文件夹的output/
目录中。
注意
如果你在设置仓库、运行示例或添加新示例方面有任何问题,欢迎通过liyifei@csail.mit.edu联系我或在GitHub上创建issue。
引用
如果您发现我们的研究或这个代码库有帮助,请考虑引用我们的论文:
@article{Li2022diffcloth,
author = {Li, Yifei and Du, Tao and Wu, Kui and Xu, Jie and Matusik, Wojciech},
title = {DiffCloth: Differentiable Cloth Simulation with Dry Frictional Contact},
year = {2022},
issue_date = {February 2023},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {42},
number = {1},
issn = {0730-0301},
url = {https://doi.org/10.1145/3527660},
doi = {10.1145/3527660},
abstract = {Cloth simulation has wide applications in computer animation, garment design, and robot-assisted dressing. This work presents a differentiable cloth simulator whose additional gradient information facilitates cloth-related applications. Our differentiable simulator extends a state-of-the-art cloth simulator based on Projective Dynamics (PD) and with dry frictional contact [Ly et al. 2020]. We draw inspiration from previous work [Du et al. 2021] to propose a fast and novel method for deriving gradients in PD-based cloth simulation with dry frictional contact. Furthermore, we conduct a comprehensive analysis and evaluation of the usefulness of gradients in contact-rich cloth simulation. Finally, we demonstrate the efficacy of our simulator in a number of downstream applications, including system identification, trajectory optimization for assisted dressing, closed-loop control, inverse design, and real-to-sim transfer. We observe a substantial speedup obtained from using our gradient information in solving most of these applications.},
journal = {ACM Trans. Graph.},
month = {oct},
articleno = {2},
numpages = {20},
keywords = {differentiable simulation, cloth simulation, Projective Dynamics}
}