Skip to content
Simulating on GPU using Material Point Method and rendering.
C C++ Cuda CMake GLSL Makefile
Branch: master
Clone or download

Latest commit

Latest commit cfb79ff Jun 22, 2018


Type Name Latest commit message Commit time
Failed to load latest commit information.
docs describe modeling Jun 20, 2018
gPointCloud commit Jun 21, 2018
images add dependencies in README Jun 20, 2018
inc remove unused operator Jun 22, 2018
obj add obj Jun 20, 2018
src remove unused operator Jun 22, 2018
third_party add svd3 Jun 12, 2018
Makefile link boost program options Jun 19, 2018 add "How to Run" section Jun 21, 2018

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.


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


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



The following libraries has been put into this repository,


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:


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!


Letters falling scene

gpgpu free fall crashed completely

Two snow balls crashed each other

two snow balls crashed each other


Other Implementations


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.

You can’t perform that action at this time.