FluidLab

Fluid simulation, right in your browser

Stir smoke, paint and water with your cursor. Every frame is solved on your GPU — no install, no sign-up, no upload. Drag the canvas to start.

Drag to stir · click for a splash

This browser can’t run the WebGL2 simulation.
Try the latest Chrome, Edge, Firefox or Safari on desktop.

— fps · …

What you can do

Three things the demos currently ranking for this term rarely offer: it keeps up with your finger, it explains itself, and it lets you take the result away.

01 · stir

Drag, splash, smear

Pointer movement injects velocity and dye into the field. Fast strokes tear the flow into vortices; slow ones push a calm plume. Touch works the same way.

02 · tune

Six knobs, real physics

Dye fade, flow drag, pressure iterations, swirl, brush size and force. Raising pressure solve removes compressibility artefacts; swirl puts back the small vortices numerics would eat.

03 · share

A link that carries the setup

Copy link stores every parameter in the URL — send it and the other person opens the exact flow you tuned. Record 5s grabs a WebM straight from the canvas.

How it works

The short version, without the maths.

This is an implementation of the Stable Fluids method: instead of pushing particles around, the velocity field itself is stored as an image and updated in five GPU passes every frame.

1 · Advect

For every pixel, look backwards along the current velocity to find where the fluid came from, and copy that value forward. This one trick is why the simulation stays stable even with large time steps.

2 · Measure divergence

Compare how much flow enters and leaves each cell. Real liquids are incompressible, so any cell that gains or loses volume needs a correction.

3 · Solve for pressure

A Jacobi iteration solves the pressure field that cancels that divergence. More iterations, cleaner flow — the Pressure solve slider controls exactly that.

4 · Subtract the gradient

Removing the pressure gradient leaves a velocity field that conserves mass. This is the step that turns a pretty smear into something that behaves like a liquid.

5 · Carry the dye

The visible colour is a passive scalar advected by the same field at a higher resolution than the solver, which is why fine filaments survive while the simulation grid stays small enough to hit 60fps.

A second engine that solves the actual discretised Navier–Stokes equations — with Reynolds number, drag coefficients and a vortex street you can measure — is being built for Lab. It is the same family of methods used in engineering CFD, scaled down to something a browser can run.

FAQ

Short answers to what people usually ask.

Is this a real fluid simulation or just a looping animation?

It is a real solver running every frame. Variables are stored in textures on the GPU and stepped through the same five stages a CFD code uses: advection, divergence, pressure projection, gradient subtraction and dye transport. Nothing is pre-rendered.

Does it work on a phone?

Yes. Touch drag injects velocity and dye exactly like a mouse. The simulation grid and detail level scale down automatically on smaller GPUs so the frame rate stays usable.

Can I use the exported video commercially?

Everything on this site is free right now, and recordings are made locally in your browser. They are intended for personal and educational use; if you want to ship a clip in paid work, ask first.

Is anything uploaded to a server?

No. The simulation, the parameters and the recording all happen in your browser. The only thing that leaves the page is a share link, which encodes your settings in the URL itself.