Get the latest tech news

Particle Life simulation in browser using WebGPU


If you don't care about the explanation and want a direct link to the simulation, here you go. You might know that I'm a sucker for physics simulations, and particle simulations in particular.

However, Vulkan, which is the supposed alternative modern API, takes 1000 lines of setup work just to show a triangle on screen, without even any vertex buffers & attributes. That's rather inconvenient, so I always round it up to the closest even number: this way, the result is always in the same binSize array, while an extra prefix sum iteration would simply copy one buffer into the other automatically (look what happens with the code when step >= array.size). into an HDR rgba16float texture, then composited onto the screen (actually, onto an HTML canvas) using ACES tone-mapping and some blue-noise dithering to hide banding resulting from dark colors on the edge of the glow.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of browser

browser

Photo of webgpu

webgpu

Photo of particle life

particle life

Related news:

News photo

Show HN: DaedalOS – Desktop Environment in the Browser

News photo

SerenityOS Creator Is Building an Independent, Standards-First Browser Called 'Ladybird'

News photo

Firefox Maker Mozilla Discontinues Pocket and Fakespot to Focus on Browser