Based on kishimisu's WebGPU-Fluid-Simulation (github.com/kishimisu/WebGPU-Fluid-Simulation), this demo implements a grid-based (Eulerian) fluid simulation using WebGPU. It follows the classic Stable Fluids method originally proposed by Jos Stam, which solves the incompressible Navier–Stokes equations by breaking the physics down into several discrete compute stages.
Highlights
Advection, curl, vorticity confinement, divergence, Jacobi pressure iterations and projection — each its own WGSL compute pass
Switchable views of dye, velocity and pressure fields
Adaptive quality: grid resolution (128² to 1024²) and pressure iterations scale to the device automatically, or can be set by hand
Adjustable vorticity, dissipation, brush size, bloom and chromatic offset
Mouse and touch input injected as Gaussian splats of dye and velocity