FluidLab

Particle simulation, 16,384 tracers

Massless particles riding a live velocity field. They leave no mass and take no momentum — they just show you where the fluid is going, in one extra GPU pass.

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

01 · tracers

16,384 massless particles

Each particle stores only a position. Every frame it is pushed by the velocity at that point, which is why the specks line up into streaks instead of drifting randomly.

02 · field

They ride a real velocity field

The same field that carries the dye carries the particles. Where the flow recirculates you get loops; where it separates you get a visible seam between two directions.

03 · compare

Toggle the overlay

Switch “Tracer particles” off to see the dye alone. Particles exaggerate direction and speed; dye shows where material accumulates. They are two views of one simulation.

How it works

Two ways to describe the same fluid

Eulerian methods store the flow on a fixed grid: every cell holds a velocity, and nothing “moves” — values are transferred between cells. That is what the solver here does, and it is why it stays stable with large time steps.

Lagrangian methods track individual elements. Real particle methods (SPH, vortex blobs) give each particle mass and let it push back on its neighbours. The particles on this page are the cheap version: massless tracers that read the field and leave it unchanged.

What massless tracers can and cannot show

They are excellent at showing direction, shear and recirculation. A patch of tracers that stretches into a thin line marks a region of strong strain; a knot that refuses to unwind marks a vortex core. Those are the same features engineers look for in flow visualisation.

They are useless for anything involving momentum exchange. Because a tracer has no mass, it cannot slow the flow, cannot collide with another tracer, and cannot reproduce settling or clustering by inertia. If you need that, you need a two-way coupled particle solver, not this page.

How the implementation works

Positions live in a 128×128 texture — one particle per texel, 16,384 in total. A fragment pass reads each position, samples the velocity field there, integrates one step, and writes the result back. If a particle leaves the domain it is respawned at a hash-derived position, so the field refills itself without CPU bookkeeping.

Rendering is a single gl.POINTS draw with additive blending: the vertex shader fetches its own position with gl_VertexID, so no per-particle buffers are needed. Adding the whole layer costs one extra pass and one draw call.

FAQ

Does this use particles to solve the fluid?

No. The fluid is solved on a grid; the particles are tracers layered on top. It is a hybrid visualisation, not a particle-based solver like SPH.

Why do the particles form streaks?

Because neighbouring tracers are carried by almost the same velocity, so a group stays together and stretches along the flow. The streak ends when the local flow turns or the tracer leaves the domain and respawns.

Can I run it on a phone?

Yes, though the layer costs extra fill rate. The solver resolution is dropped on small screens and the particle count stays fixed at 16,384.

How do I turn the dye off and see only particles?

Drag the Dye fade slider to its maximum; the colour field disappears within a second or two while the particles keep moving.