Pairwise shape deformation.
- libIGL
- CGAL
- Ceres
- pytorch
# recursively clone all 3rd party submodules
bash get_submodules.sh
# install python requirements
pip install -r requirements.txt
# install CERES (For Ubuntu)
sudo apt-get install cmake
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libsuitesparse-dev
sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
sudo apt-get update
sudo apt-get install libsuitesparse-dev
mkdir 3rd_party/ceres-solver/ceres-bin
cd 3rd_party/ceres-solver/ceres-bin
cmake -DEXPORT_BUILD_DIR=ON ..
make -j4
make test
sudo make install
# install CERES (for Mac, Homebrew)
brew install ceres-solver --HEAD
mkdir build
cmake ..
make -j8
Note that when torch must be imported before the pyDeform package in Python. i.e.,
import torch
import pyDeform
We already provide some demo shapes in the data folder. For playing with more shapes, try
cd data
wget -i filelist.txt
You will get 3625 pairs of shapes.
We provide different binaries for shape deformation with different assumptions.
- rigid_deform. Deform well-connected and uniform triangle meshes A to general shape B so that regions in A are close to B.
- rigid_rot_deform. Similar to rigid_deform. Preserving edge length instead of 3D offset, which fits better but potentially more distortion.
- cad_deform. Deform a CAD model without preassumption of connectivity or uniformness, using rigid_deform.
- coverage_deform. (experimental) Deform A to B in order to cover most regions in B without distorting A too much.
- inverse_deform. (experimental) Deform A to B so that regions in B are close to A.
The way to run them is by
./rigid_deform ../data/source.obj ../data/target.obj output.obj [GRID_RESOLUTION=64] [MESH_RESOLUTION=5000] [lambda=1] [symmetry=0].
./cad_deform ../data/cad.obj ../data/target.obj output.obj [GRID_RESOLUTION=64] [MESH_RESOLUTION=5000] [lambda=1] [symmetry=0].
cd build
export PYTHONPATH=$PYTHONPATH:$(pwd)
- For watertight mesh deformation, try
python ../src/python/rigid_deform.py --source ../data/source.obj --target ../data/target.obj --output ./rigid_output.obj
- For general CAD model deformation using traditional method
python ../src/python/cad_deform2.py --source ../data/cad-source.obj --target ../data/cad-target.obj --output ./cad_output.obj --rigidity 1
- For NeuarlODE-based deformation, try
python ../src/python/cad_neural_deform2.py --source ../data/cad-source.obj --target ../data/cad-target.obj --output ./cad_output.obj --save_path ./cad_output.ckpt --rigidity 0.1 --device cpu [cuda if possible for faster optimization]
- To generate intermediate steps during deformation with NeuralODE (assuming you have previous script done), try
python ../src/python/cad_neural_animate.py --source ../data/cad-source.obj --target ../data/cad-target.obj --output_folder ./animation --rigidity 0.1 --resume_path ./cad_output.ckpt --device cpu [cuda if possible for faster optimization]
© 2020 Jingwei Huang All Rights Reserved
IMPORTANT: If you use this code please cite the following (to provide) in any resulting publication:
To appear.