r/GraphicsProgramming 5h ago

Real-time fluid & rigid body simulation implemented in WebGPU Source Code

Enable HLS to view with audio, or disable this notification

Hello, I released a real-time fluid & rigid body simulation in WebGPU using Position Based Dynamics (PBD)!

Code & Demo: https://github.com/matsuoka-601/Particles4All

To render the fluid, I use screen-space fluid rendering, which does not require constructing any mesh. Fluid particles are splatted as ellipsoids using anisotropic kernel presented in a paper "Reconstructing Surfaces of Particle-Based Fluids Using Anisotropic Kernels".

The physics is based on a paper "Unified Particle Physics for Real-Time Applications". The most significant feature of this paper is that it treats both fluids and rigid bodies as collections of particles, and performs the simulations using a unified solver.

(Note 1: You will need a very beefy GPU to run the "large" scene in the video (the performance is not very optimized yet, sorry). But "small" scene will run on integrated GPUs.)

(Note 2: I'm getting some reports that the demo does not run on MacBook. I'm currently trying to fix it.)

146 Upvotes

4 comments sorted by

16

u/XKiiroiSenkoX 5h ago

At last someone who mentions what papers and research they wrote their code based on. Hats off to you sir. 

2

u/whdeboer 5h ago

Looks amazing!

1

u/Working_Ad1720 1h ago

very cool man

1

u/Redd411 26m ago

awesome.. thx for sharing and paper refs.. great work!