Skip to content

sgygd2004/graphics-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulation Project

Installation

Make sure your pip is up-to-date:

$ pip3 install pip --upgrade

Assume you have a Python 3 environment, to install Taichi:

$ pip3 install -U taichi

To run the demo:

$ python mpm.py

To 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 Splash Surf

# install rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# install splashsurf
cargo install splashsurf

Install Blender

# 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.xz

Add 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.

Blender Usage

blender

Import the ply file from output folder and shade it.

Producing the Demos

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 mpm

To run our other demos, run

python run_scripts.py mpm_mgpcg

or

python run_scripts.py mpm_rigid

We 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.0

When 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 OPTIX

The 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 30

Another 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages