Skip to content

WindQAQ/MPM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPM Simulation & Voxels Rendering

gpgpu free fall

This is the final project for the course, General-Purpose GPU Programming @ NTU CSIE.

We model and simulate fluid-like materials, such as snow and sand, using material point method. MPM is implemented in C++ & CUDA. And OpenGL is used for real-time result viewing. Besides, for high quality rendering, we use NVIDIA GVDB + OptiX Ray Tracing Engine.

Overview

Material point method overview

The material point method (MPM) is a numerical technique used to simulate the behavior of solids, liquids, gases, and any other continuum material. In the MPM, a continuum body is described by a number of small Lagrangian elements referred to as 'material points'. These material points are surrounded by a background mesh/grid that is used only to calculate gradient terms such as the deformation gradient. For more information, please go to Material point method - Wikipedia

Implementations

For more details about implementation, please go to our Project Page

Dependencies

Required

The following libraries has been put into this repository,

Optional

For high quality rendering as screenshots,

To generate videos from saved rendered frames,

How to Build

Source code are put in inc/ and src/. To compile the simulation program, simply type make. Compiled objects would appear in obj/, and there would be the executable file in root directory of the repository.

To compile the rendering program, GVDB-Voxels library and Nvidia OptiX ray tracing engine are needed. So please build gvdb-library at first. Then build the code in directory, gPointCloud/, which is modified from the sample code. For more information, please go to NVIDIA/gvdb-voxels.

How to Run

First of all, run make to generate the executable. Then prepare your own configuration file with format as follows:

model=MODEL

where MODEL is a JSON file formatted as:

{
  "model1": {
    "path": "PATH",
    "translate": [50.0, 0.0, 50.0],
    "scale": 0.5,
    "mass": 0.000026,
    "velocity": [0.0, -10.0, 0.0],
    "hardening": 15.0,
    "young": 1.4e5,
    "poisson": 0.2,
    "compression": 5.0e-2,
    "stretch": 5.0e-2
  }
}

The PATH is the ascii point cloud file where each line contains three values x y z seperated by a single space, and other parameters depend on your model setting. Finally, run

./test --config CONFIG_FILE

to simulate using MPM and render with OpenGL!

Screenshots

Letters falling scene

gpgpu free fall crashed completely

Two snow balls crashed each other

two snow balls crashed each other

References

Papers
Other Implementations

Contact

Issues and pull requests are welcomed, so are stars! ^_^ Feel free to contact project owner Sung Tzu-Wei, or contributors Yist Lin and Chen Li-Yu.