A texture with one more dimension

The volume density field

A 2D texture is looked up with (u,v) and returns a colour. A 3D texture is looked up with (x,y,z) and returns, here, a single density — how much medium is present at that point in space. It is stored the obvious way, as a stack of 2D slices, and it is filtered the obvious way, by blending the eight texels surrounding the sample point instead of four.

One slice
Move to probe a texel
0.50
The stack what a 3D texture is

Twelve of the slices, drawn one behind the other. The hardware stores exactly this — a contiguous run of 2D images — and texture(vol, vec3(x,y,z)) is the operation that reaches into two neighbouring slices and blends between them.

Marched through

The same volume, ray marched with a light. Drop the resolution to 8³ and switch to nearest — the texels become visible as cubes, which is the volumetric version of a pixelated texture.

The eight texels under the pointer
texelxyzvalueweight

What it costs to store memory grows cubically
Texels in this volume
As 8‑bit density (R8)
As 16‑bit float (R16F)
The same volume at 256³, R16F
At 512³, R16F

Doubling the resolution costs eight times the memory, not four. That single fact is why production cloud systems rarely store a big uniform grid — they use sparse structures, tile the volume, or generate the density procedurally in the shader and store nothing at all.

Resolution
One texel spans
Density at the pointer
Filtering
Trilinear is not eight lookups on a good day. Sampling a 3D texture with filtering enabled is a single instruction on any modern GPU, and the eight-texel blend happens in dedicated hardware — which is precisely why volumetric renderers go to the trouble of storing density in a texture rather than evaluating a noise function per step. The comparison is worth making explicit: the procedural route costs arithmetic and no memory, the texture route costs memory and almost no arithmetic, and a real cloud renderer usually does both, with a coarse texture giving the shape and cheap noise added on top for detail. Switch to nearest above and watch what the filter is actually buying you: without it, every step of the march inside one texel returns an identical value, so the volume renders as a field of blocks.