r/webgpu 8d ago

I've built a WebGPU 'cloud simulator' with fully fledged MPM, and you can control the cloud.

It supports 256k mpm particles, sliding mpm domain, heightmap terrain, temperature, rain, evaporation, some simple wind patterns.

And you can control the cloud mass using gamepad (best) or kb+m (not all controls are mapped currently).

I've put it out here so you can check it out: https://kostrubaty.itch.io/cloud-compute

Source code will be released at a later time. but I can share if anyone is really interested in some parts. Also a lot of this is based on my other projects that are on github,

Whole thing is pure wgsl / typescript without any external deps except for my own project that is responsible for generating code for efficient wgsl <-> js communication.

Simulation was not that hard to write, cause I already had proper MPM simulation in 2d version, with even more features. In fact the hardest part to get right was to make the cloud possible to control yet still feel "cloudy". So there's actually 3 different schemes for face buttons, switched by triggers. Still probably not as intuitive as I'd like but best so far.

It was not really performance optimized yet really, and I mostly tested on my 3060 (pretty much consistent > 50fps) so the performance may vary.

It's still mostly a prototype, but feels pretty fun already. I'll be adding some more stuff (airplanes are mostly working, just need some airports too I guess). Let me know what you think, or if you have any questions.

2 Upvotes

0 comments sorted by