MPM Snow Simulation via CUDA
Class | Instructor | Date | Language | Ta'ed | Code |
---|---|---|---|---|---|
CSE 6730 (continued as personal project) | Richard Fujimoto | Spring 2018 | Java/JCUDA | No | Github Repo - MPM Snow |
MPM Cuda project with recompiled kernel, and updated to Jcuda for CUDA 9.2
Originally this project was a team project for a Simulation class, where we implemented both multithreaded CPU-based and GPU-based (via CUDA) solutions for snow simulation based on the famous Material Point Method for Snow Simulation paper, which I had wanted to implement since I saw the paper at Siggraph the year it came out.
Like most school projects, it had a few bugs, which I've since ironed out, and I've also merged a few of the kernel functions and fixed a few bugs in the calculations, restructured how the kernel calls are built and called, and generally cleaned up and streamlined the java code. I've also changed some of the default values so that the sim isn't so brittle, which enabled me to increase the timestep by a factor of 10.
Old MPM Snow Simulation via CUDA |
I have recently refactored the system further to be more flexible for future implementations/expansions of the kernel, as well as to support other kernelized graphics algorithms and projects. The video below shows the newest implementation. 6 randomly generated snowballs constructed of 200000 total material points evenly distributed, given an initial velocity of 30 targeting a location near the COM of the generated balls. The simulation replays displaying material points, point velocities, grid velocities, grid accelerations and other framework/geometry. The colors of the particles reflect their initial placements (X,Y,Z -> RGB). The video is in realtime - the system is able to take a variable number of simulation steps between each rendering step that can be specified via the UI. The rendering is a bottleneck - all the material points and subsequent vectors are copied to graphical constructs at render time, after they've been copied from the JCuda device area, effectively copying them twice. Ideally they'd be copied into a VBO-like construct that could be sent directly to a shader.
Current MPM Snow Simulation via CUDA |