FluidLab

3D flow, rendered as a volume

Nineteen velocity directions, 160,000 cells, forty solid spheres. Drag to orbit the box — the haze is the flow field, integrated along every ray.

56 × 32 × 32 · drag to orbit

160k fluid cells around 40 solid spheres. Drag on the canvas to orbit; the haze is speed (or pressure / vorticity), the balls are shaded from a distance field stored in the same 3D texture.

Grid
56×32×32
Spheres
—
Solid fraction
—
Timesteps
—
Frame rate
—
Renderer
WebGL2

What a D3Q19 step actually does

The two-dimensional pages use nine directions per cell. Here each cell carries nineteen distribution values: one at rest, six along the axes, and twelve along the face diagonals. The step is the same idea as before — relax towards a local equilibrium, then move each value to the neighbouring cell in its own direction — just with more directions and a third axis.

Solid spheres are handled by bounce-back: when a streaming direction would enter a solid cell, the value is reflected back the way it came. That gives a no-slip wall without any mesh, which is the reason a random packing like this needs no geometry work at all.

How the picture is made

01 · texture

Field into a 3D texture

Every frame the velocity field is packed into an RGBA8 volume: red is the field, blue is a distance field used to shade the spheres, alpha is unused.

02 · rays

One ray per pixel

The fragment shader intersects the box, then marches 24–96 samples through the volume, accumulating colour with a front-to-back alpha blend.

03 · spheres

No extra geometry

When a ray reaches a cell inside a sphere, the distance field gives a normal in three extra texture reads and the ray stops with a shaded surface. No impostor meshes, no second pass.

Why this is still a toy

The grid is coarse enough that individual spheres are only a few cells across, the domain is periodic-looking but actually walled, and there is no turbulence model — at this Reynolds number the wakes are already unsteady and only partially resolved.

What survives all that is the qualitative picture: flow finds channels through a packing, wakes form behind obstacles, pressure builds on upstream faces. Those are the features people actually look for when they first see a porous-medium simulation, and they cost a browser tab here.

FAQ

Is this really three-dimensional?

Yes — 56×32×32 cells, nineteen velocity directions (D3Q19), solid spheres resolved as bounce-back walls. The image is a volume render: every pixel marches a ray through the box and accumulates the field along the way.

Why does it look cloudy?

That is the rendering, not the physics. A volume render integrates the field along each ray, so dense regions become opaque and thin ones become haze. There is no surface to draw — except the spheres, which are shaded from a distance field.

Why only 56×32×32?

A D3Q19 step in JavaScript costs roughly two hundred bytes of work per cell per step. This grid is about 160,000 cells; going to 128³ would be eight times slower and would not run at interactive rates on a laptop.

What should I look for?

Switch to vorticity and watch the wakes behind individual spheres. Switch to pressure and look for the high-pressure patch on each upstream face. The spheres are randomly packed, so the flow has to find its way through — that is the same problem a porous medium solver faces.