Using the Moving Least Squares Material Point Method (MLS-MPM), which allowed for real-time simulation with around 100,000 particles on integrated graphics and up to 300,000 particles on mid-range GPUs, matsuoka_601 implemented this cool jello-like fluid in WebGPU. Smoothed Particle Hydrodynamics (SPH) is also included, which can be enabled by clicking the SPH button in the top right corner.
Below are the characteristics of this simulation:
- Moving Least Squares Material Point Method (MLS-MPM);
- Particle to Grid (P2G) stage implemented with atomicAdd;
- Smoothed Particle Hydrodynamics (SPH) based on Particle-Based Fluid Simulation for Interactive Applications;
- For fast neighborhood search on GPU, an algorithm described in NVIDIA’s paper is used;
- Screen-Space Rendering described in another NVIDIA’s paper is used for real-time rendering of the fluid.
The developer was inspired by nialltl’s article, which explained that a vanilla implementation of MPM isn’t ideal for real-time simulation due to inaccuracies in volume estimation, which forces the timestep to be small. To address this issue, the article proposed recalculating the volume at every simulation step. Apparently, this method is highly effective for using larger timesteps and currently requires only 2 simulation steps per frame.
This is still a work in progress, as matsuoka_601 has a to-do list to work through, is actively learning MLS-MPM, and plans to get rid of artifacts while improving the handling of even larger real-time simulations.
Visit the GitHub repository for more information, and try the simulation in your browser by clicking this link.
Also, don’t forget to join our 80 Level Talent platform and our new Discord server, follow us on Instagram, Twitter, LinkedIn, Telegram, TikTok, and Threads, where we share breakdowns, the latest news, awesome artworks, and more.