9 ms·
Show HN: I’ve made a real-time 3D fluid simulation in WebGPU
Hello,
I've deployed a real-time 3D water simulation for browsers. Works on your browsers which support WebGPU.
- demo: https://splash-fluid.netlify.app/ https://splash-fluid.netlify.app/
- code: https://github.com/matsuoka-601/Splash https://github.com/matsuoka-601/Splash
- demo video: https://www.youtube.com/watch?v=9C7DRSdh88g https://www.youtube.com/watch?v=9C7DRSdh88g
To my knowledge, this is one of the largest scale fluid simulations for browsers. Around 70,000 particles can be simulated in real-time on my laptop with only an integrated graphics. With a discrete GPU (e.g. RTX 3060 laptop), 180,000 particles can be simulated in real-time.
An algorithm called MLS-MPM (Moving Least Squares Material Point Method) enabled this level of real-time performance in browsers. For real-time rendering of the fluid, a technique called Screen-Space Fluid Rendering is used.
If you want to know more, also see the GitHub repo!
- DemocracyFTW2 2y agoI tried in Firefox, Chromium and Vivaldi, but none of these browsers work...
- matsuoka-601 2y agoSadly it seems like these browsers doesn’t support WebGPU… I think Chrome, Edge and Safari (with WebGPU flag enabled) support WebGPU, but the support is still limited in other browsers.
- DemocracyFTW2 2y agoAccording to https://caniuse.com/?search=webgpu https://caniuse.com/?search=webgpu I should be able to use Edge and Opera, but neither works; I'm on Linux Mint, if that makes a difference
- matsuoka-601 2y agoAccording to that website, WebGPU is not supported by default on Linux (see 5 in Notes). As for Edge, WebGPU itself is supported, but getContext is only supported on Windows OS, Mac OS and Chrome OS only (see 1 in Notes). WebGPU support on Linux seems to be limited compared to Windows and Mac.
- DemocracyFTW2 2y agoAh alright I see, thanks for weighing in
- matsuoka-601 2y agoThere are still many environments which don’t support WebGPU. I recommend watching demo video if WebGPU is not supported in your environment.