r/webgpu • • Dec 06 '25 Bravo

100,000 Particle Life Simulation running on WebGPU

764 Upvotes

This is an adaptation of the particle life simulation to run on WebGPU using compute shaders!
It can run around 20,000 particles with a reasonable interaction radius. If the interaction radius is decreased though, the particle count can go to 100,000+ when running on counting sort / atomic linked lists.
To optimize performance the particles are put into spatial cells and separated. I did this with atomic linked lists / counting sort.
The implementation and code is quite rough, but with some work it could potentially become a WebGPU sample.

Live demo: https://gpu-life.silverspace.io
Repository: https://github.com/SilverSpace505/gpu-life


r/webgpu • • Nov 10 '25

"Jelly Slider" in TypeGPU

620 Upvotes

This is an example built by my collegue u/reczkok, inspired by the design work of Voicu Apostol. It was built entirely with TypeGPU, no extra libraries, with all shaders written in TypeScript. We got to try out features like console.log on the GPU and “bindless” resources from the 0.8 release, which made the overall process really smooth.

It was very inspiring to see this come together live, took a lot of optimizing to get it running in real time on mid-range mobile phones. I'm really happy to see that TypeGPU is a library that helps the developer optimize, rather than abstracting away so much that it's harder to see what's happening under the hood.

Try it out here:
https://docs.swmansion.com/TypeGPU/examples/#example=rendering--jelly-slider

Source code here:
https://github.com/software-mansion/TypeGPU/blob/main/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts


r/webgpu • • Dec 09 '25

Particle Life 250k

387 Upvotes

r/webgpu • • Apr 21 '26

Webgpu is unbelievable. A million particles running in a browser with 1mb of code.

309 Upvotes

This is an emergence engine I'm making using webgpu and three.js. By that I mean applying environmental conditions (like curl noise) on a particle system to induce emergent behavior. Lots more videos on /r/ScaleSpace if you want to fall down the rabbit hole.

Edit: I did a poor job of explaining, sorry. Most of that 1mb comes from three.js. I was just referring to the bundled standalone.


r/webgpu • • Jan 07 '26

Particle system and physics engine

307 Upvotes

Hello! I wanted to share a library I made to make animations like the ones in the video:

👉 https://caza.la/party

The homepage runs a few different configurations, so you can get a sense of what can be done by watching for a bit.

Or if you are on desktop, you can use the playground to try it out in realtime.

Some of the modules included are: boid-like behaviors, elastic collisions, hydrodynamics (SPH), physarum-inspired networks, and a few more.

Let me know what you think :)


r/webgpu • • Feb 10 '26

Real-time 3D CT volume visualization in the browser

300 Upvotes

r/webgpu • • Feb 11 '26

WebGPU 3D fluid simulation

230 Upvotes

Just a sneak peek of a WebGPU 3D fluid simulation that I am working on in spare time, porting and expanding upon the Smoothed Particle Hydrodynamics (SPH) concepts popularized by the legend Sebastian Lague.

Multiple rendering techniques are supported:
- Billboard Particles: Efficient indirect instanced rendering with frustum culling and dynamic shadow mapping.
- GPU Marching Cubes: Real-time polygonal mesh extraction from the fluid density field.
- Volumetric Raymarching: Approximates Signed Distance Fields (SDF) from particles to simulate thick, jelly-like liquids with realistic light extinction.
- Screen-Space Fluid: A high-end surface reconstruction pipeline featuring bilateral depth smoothing, normal reconstruction, foam advection, and refraction based on Beer’s Law.

Right now the biggest challenge is to improve the performance on mobile devices, it's not fun :( Don't load the live demo on your mobile phone, it may crash.

Ah, I also ported the 2D fluid simulation to WebGPU.

3D live demo: https://jeantimex.github.io/fluid/
2D live demo: https://jeantimex.github.io/fluid/webgpu2d.html
Current project: https://github.com/jeantimex/fluid
Sebastian's Unity project: https://github.com/SebLague/Fluid-Sim
YouTube tutorial: https://www.youtube.com/watch?v=kOkfC5fLfgE


r/webgpu • • Mar 05 '26

Built a real-time PBR renderer from scratch in Rust/WebGPU/WASM

224 Upvotes

Built a real-time PBR renderer from scratch in Rust/WASM, running entirely in the browser via WebGPU.

I am in love with Rust + WebGPU + WASM!

Cook-Torrance BRDF · GGX specular · Fresnel-Schlick · HDR IBL (prefiltered env + irradiance + BRDF LUT) · PCF shadow mapping · GTAO ambient occlusion · bloom · FXAA · chromatic aberration · tone mapping · glTF 2.0 (metallic-roughness + specular-glossiness + clearcoat + sheen + anisotropy + iridescence + transmission) · progressive texture streaming.


r/webgpu • • Apr 26 '26

I programmed rendering of black hole from scratch.

189 Upvotes

I wrote render of black hole gravitational effect. Here if you want to try it in browser (good GPU + up to date web browser recommended) or you can check out source code on github or codeberg.

I wrote it from scratch, as I always wanted to do (and to understand) ray tracing and 3d rendering. I took it on as a recreational programming project but ended up sinking quite a a lot of days into it — something that could be done in three hours of vibe coding, but that’s where the enjoyment is.
It was fun to first figure out how to do a simple 2d simulation, then ray tracing rendering, and then combine them together in 3d and add webgpu — because otherwise I would get one frame every five minutes. Now it runs smoothly on my mac.
As a novice in web space (not as programmer) I must say I am surprised by web capabilities. I found some 3d websites made by NASA (solar system, 2020 rover...) and it show how really cool stuffs can be made and are easily sharable. Planning to work on some similar projects as space topics are one of the best for visualizing.

I was kinda expecting a lot of haggle with webgpu, but I had smooth experience, the programming was easy, just tricky part for me was to allocate for scene.

There are still a lot of improvements I can make, like using real photos for textures, which would definitely elevate the quality instead of having everything coded. That sounds fun, so I’ll probably do it—but not in the near future, since I’ve written enough for now, haha.

I do plan to write some .md article about how to write what I wrote in code, but that will take some time. If there’s interest, I can do it sooner. Anyway, I recommend checking out the references I used. My favorite was from NASA, but unexpectedly the most useful was about polar coordinates. Before, I tried to write everything in normal vector coordinates, but there was artifacting on the xyz axis and overall the black hole looked confusing... and it changed depending on the size of the steps for the rays I sent for each pixel. Changing it to polar coordinates was like magic: all the artifacts disappeared, and I even got a second (thin) ring, which I hadn’t noticed black holes have.


r/webgpu • • Jun 26 '26

WebGL Water upgraded to WebGPU Water 💧

187 Upvotes

Back in August 2011, Evan Wallace (who later co-founded Figma and wrote esbuild) released WebGL Water - the raytraced pool with real-time caustics that pretty much every web-graphics enthusiast remembers. ~15 years on, I figured it deserved a WebGPU version, so I ported the whole thing.

Live demo (WebGPU, falls back to WebGL2): https://willeastcott.github.io/webgpu-water-playcanvas/

Source: https://github.com/willeastcott/webgpu-water-playcanvas

The 2011 original: https://madebyevan.com/webgl-water/

The bit that's interesting for this sub: rather than transpiling GLSL → WGSL at runtime, every shader is authored in both languages side by side (LLMs are great and managing both versions and keeping them in sync). On WebGPU it runs native WGSL - no transpiler, no WASM - and still falls back to WebGL2 with the original GLSL.

It's a faithful port of the original rendering + sim:

  • GPU heightfield water sim on ping-pong float render targets (RGBA32F, half-float fallback)

  • Real-time caustics via the differential-area method (the projected-mesh trick from Evan's writeup)

  • Raytraced reflection + refraction off the pool and a draggable, buoyant sphere

  • Analytic ambient occlusion, soft blob shadow, sky cubemap

  • Built on the PlayCanvas engine (just the npm package - standalone Vite app)

I also added scroll-to-zoom and made click-drag paint a continuous ripple trail instead of a row of separate drops.

Disclosure: I work on PlayCanvas. This is just a fun open-source port, though - all the original genius is Evan's.


r/webgpu • • Jul 22 '25

WebGPU has officially shipped in Firefox*!

158 Upvotes

* For Windows in version 141

Not sure about other platforms yet, but on Windows it looks like dom.webgpu.enabled defaults to true now


r/webgpu • • Sep 28 '26

Rust + WebGPU: A Multi-Platform Physics-Based Paint Engine

155 Upvotes

Hello. I tried making a paint simulator that runs on multiple platforms using Rust and WebGPU.

I had originally built a general raster paint engine based on C++ and OpenGL ES 2.0. Since it was getting quite dated, I've been replacing it with Rust + WebGPU, and it's finally running on Windows too.

There's a version you can try in the browser for now, so please give it a go if you're interested.
https://mignonsketch.com/sketch


r/webgpu • • Jan 21 '26

Built a weather globe using WebGPU compute shaders - irregular grid sampling, marching squares, streamline tracing

Post image
155 Upvotes

Built a browser-based weather visualization that renders ECMWF forecast data (6.6M-point irregular grid) entirely on GPU. Wanted to share what worked and get feedback on the approach.

Live demo: https://zero.hypatia.earth Source: https://github.com/hypatia-earth/zero

Architecture:

Multi-pass pipeline:

  1. Compute passes - pressure contours (marching squares + smoothing), wind streamlines (tracing)

  2. Render passes - globe via fullscreen triangle (ray-sphere in fragment), line geometry for pressure/wind, atmosphere scattering blend

What worked well:

  • Binary search in WGSL for irregular O1280 Gaussian grid lookup - precomputed LUTs for latitude positions and ring offsets, search in shader

  • Marching squares in compute shader for isobar contours - count pass, GPU prefix sum for offsets, generate pass

  • Chaikin corner-cutting for curve smoothing - ping-pong buffers, 2 passes = 4x vertex expansion

  • Rodrigues rotation for wind streamline tracing - geodesic movement on sphere surface

  • Fibonacci sphere for uniform seed point distribution (8K-64K wind lines)

What didn't work:

  • Regridding to textures first - too slow for 6.6M points, quality loss from interpolation

  • Geometry-based globe mesh - vertex count explosion at high detail levels

  • CPU-side contour generation - latency killed it, couldn't batch with render

Performance:

Sub-3ms frame times on M4. Compute passes cached - only rerun when timestep changes. Animation is render-only.

Questions for this community:

  1. What other weather layers would benefit from compute shaders? Considering animated clouds or precipitation next.

  2. WGSL pain points at scale - how do you organize 1000+ lines of shader code?

  3. Rendering thousands of animated streamlines kills mobile perf. Currently triangle-list with 6 verts per segment. Alternatives?

Would appreciate any feedback on the shader architecture. Happy to share code snippets if useful.


r/webgpu • • Dec 01 '25

[Showcase] Train and visualize language models with WebGPU

126 Upvotes

Fun side project I've been hacking away at for a while: I implemented backprop + LazyTensor in wgpu for what amounts to a small PyTorch clone. This was enough to build a fun playground for configuring and monitoring small transformer training runs completely in-browser.

Play with it in your browser and check out the deep-dive blog post!


r/webgpu • • Jun 08 '26

WebGPU video editor scrubbing test on a longer timeline

116 Upvotes

I’ve been building from scratch a browser-based video editor with WebGPU, WebCodecs, and Mediabunny.

Just shipped a few small optimisations around timeline scrubbing, so wanted to share a quick test.

The screen recording knocks the performance a bit, but you can still get the idea.

This is a longer timeline with around 30 clips, fairly zoomed out. Still not perfect, but scrubbing is starting to feel pretty good now, even on the machines that were struggling more.

I've had to implement a lot of device-specific behaviour, though. Apple Silicon, Intel Macs, and Windows machines all seem to want slightly different treatment.

On higher-end Apple Silicon, running the whole thing with WebGPU, WebCodecs, and Mediabunny for playback and scrubbing feels really nice.

Curious how others are handling scrubbing/preview rendering in WebGPU-based editors?

Framecompose.com


r/webgpu • • Sep 29 '24

Making my WebGPU renderer

101 Upvotes

I am excited to share my results after a few weeks developing my WebGPU 3D renderer for web. For a few years, I was stuck developing games on WebGL, and now WebGPU seems to be a breath of fresh air. I never touched low level WebGL or WebGPU before, mostly worked with Three JS or PlayCanvas, so it seemed to me a great chance to learn. And it feels like it is. I only got the basics done: ShaderLib for composing shaders from chunks, buffers management, Directional Light, Fog, PCF Shadows, Phong Material, GLTFLoader, instancing, as well as a few extras that I just love: Wind Shader and Boids. I am excited about how well it performs on both PC and mobile hitting 60 FPS on my iPhone 13 without a sweat.


r/webgpu • • Jan 27 '26

C++ WebGPU Shader Engine Progress (part 1)

93 Upvotes

r/webgpu • • May 11 '26

Porting Pokemon Cards CSS to WebGPU

90 Upvotes

Made some good progress, but still got a ton of effects to complete!


r/webgpu • • Jun 03 '26

SuperSplat moves to WebGPU for huge performance gains

88 Upvotes

r/webgpu • • Jun 09 '25

WebGPU enabled in Safari 26 beta. This is a significant moment isn't it?

85 Upvotes

https://webkit.org/blog/16993/news-from-wwdc25-web-technology-coming-this-fall-in-safari-26-beta/

So this means, when Safari 26 is released in the Fall, WebGPU will be the default graphics/compute standard for the web, right? . It is on all Apple platforms. It does look like it might be released for some older OSs/devices. I want to get excited about this but I'm guessing there's a catch somewhere?


r/webgpu • • Oct 25 '24

WebGPU Renderer Devlog 4: First Person Forest Walk in the browser

84 Upvotes

r/webgpu • • Jul 20 '25

Realtime path tracing via WebGPU in mobile Safari 26 beta

Thumbnail
gallery
76 Upvotes

As iOS26 enables support for WebGPU in Safari by default, I decided to brush off my pathtracer I wrote last year and add touch controls to it. The screenshots are taken on an iPhone 16 Pro and take around 4-7 minutes to render. Give it a try here.

P.S. Heat warning, especially on mobile!


r/webgpu • • Jan 14 '25

WebGPU Sponza

76 Upvotes

Sponza scene with animated grass, point lights, pbr materials, and particles. All running at 165 fps on my pc. You’re welcomed to play with the engine and leave your comments: https://github.com/khudiiash/webgpu-renderer/tree/dev


r/webgpu • • Jun 23 '25

The problem with WebGPU libraries today

Thumbnail
gallery
75 Upvotes

I recently gave a talk at Render.ATL about WebGPU-enhanced libraries, and the problem of interoperability between these libraries. I would love to share my thoughts about the problem here, and a possible way forward. Thanks for reading in advance! 💜

WebGPU is an amazing piece of technology, allowing for truly cross-platform graphics and GPGPU programming. It is being used by frameworks like Three.js and TensorFlow to accelerate their internals. However, when we try to connect libraries together, we soon hit a limit...

Let's say we wanted to pull a texture out of Three.js, and use it as a tensor in Tensorflow.js. If their internal data structure matches, they can just share a VRAM pointer to avoid copying to RAM and back unnecessarily (could be ~100x slower than the actual work we want to do). Unfortunately, it is rare for APIs to be seamlessly compatible with one another, so we need "glue code" for interop. We have two options:

  1. Copy data, and transform it in JS/TS (extremely slow, but great DX)

  2. Write a compute shader to operate on VRAM directly, and glue the APIs there (lightning fast, but requires juggling untyped memory pointers and writing custom compute shaders)

My team and I have been working on a solution to this problem, called TypeGPU. What if we could write the glue code in TypeScript, and compile it to WebGPU Shading Language instead? We would get hints from the language server about both the output of Three.js, and the input of Tensorflow.js.

I like to use the analogy of server & client, as writing both CPU and GPU logic in TypeScript gives you the same benefits here. Write a single code-base, and using modern tooling like Vite, tell the bundler which functions should be executable on the GPU. We hook into the build process with our custom plugin to allow for this. The GPU can be thought of as just an endpoint with an API, and instead of binary blobs and strings, that API can be made type-safe!

And it's not just the "glue code" that becomes better, library APIs can become more customizable! A library can defer shader logic to the user by accepting marked TypeScript functions. Dependency Inversion, without compromising efficiency!

  // A library can accept more than just config
  // values... it can accept behavior!
  //
  // Here's an example of a "plotting" library,
  // allowing users to alter the size and color
  // of each point based on its position.
  const xyz = await initXyz(root, {
    target: getCanvas(),
    pointSize: (pos) => {
      "kernel";
      return sin(pos.x * 20) * 0.002;
    },
    color: (pos) => {
      "kernel";
      return vec3f(1, sin(pos.z * 10), 0);
    },
  });

We're building libraries on top of TypeGPU as we speak, and we would love to work with everyone building their own GPU-enhanced libraries. You can keep full flexibility of your internals, and still use plain WebGPU & WGSL. We handle the API, so you can focus on your library's core value.

Thank you for reading till the end, I'm anxious to hear your thoughts!