Make sure your pip is up-to-date:
$ pip3 install pip --upgradeAssume you have a Python 3 environment, to install Taichi:
$ pip3 install -U taichiTo run the demo:
$ python mpm.pyTo run the test script (The test script is for reference only; the final score will be based on the actual results. Additionally, the test script depends on the default parameters defined in mpm_3d_config.py):
$ python mpm_3d_test.py# install rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install splashsurf
cargo install splashsurf# download blender 3.6 Linux package from https://www.blender.org/download/lts/3-6/
# uncompressed the .tar.gz file
tar -xf blender-3.6.7-linux-x64.tar.xzAdd the following line in your ~/.bashrc file.
# update the $PATH variable
# add the following line in ~/.bashrc file
export PATH=$PATH:~/blender-3.6.7-linux-x64/The rendering script is tested with blender 3.6.7 and blender 4.0 seems uncompatible.
blenderImport the ply file from output folder and shade it.
First, turn the "output_frames" and "output_ply" onto True. Make sure the current_present_id is set as desired. In our final demo, it is set as 4, where a bunny, a dragon and a square of water will be presented. Then, run
python run_scripts.py mpmTo run our other demos, run
python run_scripts.py mpm_mgpcgor
python run_scripts.py mpm_rigidWe have tuned the parameters to meet what we present in the final presentation.
To make the .ply particle file into .obj file for rendering, you can do surface reconstruction with the following command (As an example of 3 objects, which we presented in the demo, and you may change it accordingly):
python surface_reconstruction.py --input_dir ./mpm3d_simulation_output --num_workers 2 --radius 0.01 0.01 0.01 --smoothing-length 2.2 2.0 3.0When reproduce my rendering result, make sure the scene2.blend is in the folder and run
CUDA_VISIBLE_DEVICES=0 python render.py --scene_file ./scene2.blend
--input_dir ./mpm3d_simulation_output --num_workers=1 --device_type OPTIXThe blender rendering pipeline in this project was modified based on code from https://github.com/jason-huang03/SPH_Project. We found that the original implementation of surface reconstruction do not address the difference of particle density of different objects. Using same radius and smoothing length may be toublesmoe in the visual result, when large particle density difference exists. To address this issue, we modify the script to handle different hyper params for different objects.
To make a video, you can run the following command to make the images into a video.
python make_video.py --input_dir ./mpm3d_simulation_output \
--image_name render.png --output_path video.mp4 --fps 30Another thing is that, user in github "zst1406217" is actually Runhan Huang. He forgot to change the username and email when using the lab's computter.