Houston Stratified Noise

Houston Stratified Noise (HSN) is a screen-space sampling noise for real-time rendering that needs no texture and no precomputation: about a hundred integer operations per value, written inline in the shader. It is meant for downloadable, fast-starting 3D graphics on the web, where a sampler has to be texture-free (nothing to download) and precomputation-free (nothing to generate at startup).

It gives every aligned 8×8 tile of pixels the 64 values k/64 in a scrambled Bayer order, rotates each tile by a hashed phase, and steps every value by an integer Weyl sequence each frame, with a different step for each value per pixel.

This site accompanies the blog post Introducing Houston Stratified Noise. The technique is used in Three.js in pull request mrdoob/three.js#35429. Every number and figure here is regenerated by the scripts in the repository; the Results page lists them all with the command for each, and the Explorer runs the same noise code in your browser.

What the measurements say

  1. In the engine it is level with FAST blue-noise textures, at zero bytes. In SSR and VXGI under TRAA, HSN is level with the FAST blue-noise textures on frame RMSE (VXGI 9.99 against 10.18, within run-to-run variation; SSR 2.982 against 2.981), at zero bytes against a 3.0 MB atlas. The error is distributed differently: in VXGI FAST has 19% lower bias while HSN has 7% less temporal noise and 4% less flicker; in SSR HSN has 15% lower bias while FAST has about 1% less noise and flicker. The plain hash with per-value steps also matches or beats FAST on RMSE. The flat-field gaps against FAST did not carry over to the engine, likely because TRAA and the denoiser are not the filter the FAST atlas is optimised for (untested). Scope: two effects, a static camera, one GPU, and FAST call sites written for this measurement.
  2. The fix that matters is one integer Weyl step per value. The previous Three.js SSR and VXGI samplers were biased because their values per pixel were not independent. Giving each value its own integer Weyl step fixes that, and every variant measured that does so removes the banding.
  3. The hierarchy's measured in-engine benefit over a plain hash is lower flicker. A plain per-pixel hash with the same steps matches HSN on SSR within 2%. On VXGI, like for like with R2 steps, the hash is about 4% lower on RMSE (8.86 against 9.26) with about 24% more flicker (5.07 against 4.09). HSN costs four hashes per value against the hash's one, with no measurable frame-rate change.
  4. It is not blue noise. On a single frame it is isotropic and free of spectral peaks, like blue noise, but its low frequencies are only partly suppressed, and its error after a blur is worse than interleaved gradient noise (IGN), R2 and blue-noise textures.
  5. IGN-based samplers are still better for one value per pixel. Under exponential accumulation and a blur, animated IGN has about 1.5 times lower error, and IGN as a spatial phase with a golden-ratio Weyl step is also ahead (6.24 against 7.57).

Samplers like this are used under temporal accumulation (TRAA or an exponential moving average over roughly 16 to 32 frames, with a small spatial filter), so the accumulated results come first. Single-frame and short-history results follow; they characterise the pattern and the frames right after a history reset.

Accumulated over time

In Three.js on a real GPU, steady state after TRAA

Mean ± SD over three runs of 256 frames, ×10⁻³, change against the previous sampler; Apple M3, hardware WebGPU. H is the FAST spatio-temporal atlas; A to D are simpler fixes run through the same harness. The shipped HSN row uses the first two R4 steps for VXGI while A, B and D use R2 steps, so compare A with C for a like-for-like step set. Bias is measured against white noise through the same TRAA, which may favour the plain hash in the bias ranking.

VXGI

SSR, denoised

One static scene and camera per effect and one GPU; motion and disocclusion were not measured. The method, the light map bake and the limits are on the Results page.

CPU model: exponential accumulation with a blur

CPU model. Steady-state RMSE ×1000 under an exponential moving average (α = 0.1, about 19 effective frames) and a Gaussian σ = 1 blur, static flat field. Lower is better. The animated IGN error for two and four values per pixel is bias from its correlated values.

With one value per pixel HSN matches or beats the FAST and STBN textures on thresholded signals; on smooth one-value test functions FAST is about 30% better and STBN about 14%. With two values it trails FAST by 25%, and a plain hash with the same steps ties it once about four frames are accumulated. With four values it is 7–12% better than stacked FAST and STBN, behind void-and-cluster with per-value steps, and keeps a small lead over the plain hash (4–14% depending on the window, about 14% at 32 frames). Per-pixel convergence comes from the Weyl steps, not from the hierarchy.

Single frame and short histories

This is also the regime right after a history reset (a disocclusion or a camera cut), and it is where HSN is furthest from blue-noise textures: on one frame its blurred error is 34% (one value per pixel) and 56% (two values) higher than FAST's.

All single-frame figures and tables are on the Results page.

The function

The reference implementation, src/noise/hsn.js, is an operation-for-operation transliteration of the Three.js TSL into wrapping 32-bit unsigned arithmetic:

function hashUint( v ) {

	v = Math.imul( v ^ ( v >>> 16 ), 0x21f0aaad );
	v = Math.imul( v ^ ( v >>> 15 ), 0x735a2d97 );
	return ( v ^ ( v >>> 15 ) ) >>> 0;

}

function pixelHash( x, y, seed ) {

	return hashUint( Math.imul( x, 0x9e3779b1 ) ^ Math.imul( y, 0x85ebca77 ) ^ seed );

}

function noise( x, y, index, seed, step = 2654435769 ) {

	let rank = 0;

	for ( let level = 0; level < 3; level ++ ) {

		const scramble = pixelHash( x >>> ( level + 1 ), y >>> ( level + 1 ), seed ^ Math.imul( level + 1, 0x632be5ab ) );
		const a = ( x >>> level ) & 1, b = ( y >>> level ) & 1;
		const low = scramble & 4 ? a : b;
		const child = ( ( a ^ b ) << 1 ) | low;
		rank |= ( child ^ ( scramble & 3 ) ) << ( 30 - 2 * level );

	}

	const phase = pixelHash( x >>> 3, y >>> 3, seed ^ 0x02e5be93 );
	return ( ( rank + phase + Math.imul( index, step ) ) >>> 8 ) / 16777216;

}

How it is built

1. Start from a Bayer matrix

A Bayer ordered-dither matrix assigns ranks two bits at a time, finest scale first. Level 0 (which pixel inside its 2×2 block) supplies the most significant digit, so stratification starts at the smallest scale. With every scramble bit forced to zero, the 6-bit rank is exactly the classic 8×8 Bayer matrix.

2. Scramble each block

A hash of the parent block (the 2×2 block, the 4×4 block, the 8×8 tile) supplies three bits: one swaps the orientation and two are XORed into the 2-bit rank. That picks one of the eight rotations and reflections of the 2×2 Bayer cell. A permutation of a block's children is still a permutation, so stratification is untouched.

3. Rotate each tile

A full 32-bit hash of the tile coordinate is added to every value in the tile (a Cranley–Patterson rotation). The tile still holds 64 values exactly 1/64 apart; only their offset differs from tile to tile.

4. Step in time

Each frame adds the same integer constant to every pixel, wrapping at 2³². For a scalar the step is 2³²/φ (the golden ratio), so each pixel's values over time form a Weyl sequence that keeps splitting the largest remaining gap. The spatial pattern on frame t is the frame-0 pattern rotated in value, so every spatial guarantee holds on every frame. The time term is an integer multiply, so there is no float drift and the 32-bit state repeats only after 2³² frames.

5. More than one value per pixel

Each value per pixel uses a different seed and a different step: Martin Roberts' R2 or R4 constants (2³²/φdk+1 for value k) rather than one shared golden step. With a shared step the values advance in lockstep and per-pixel error stops converging; the Explorer shows this. In Three.js, the bound helper in examples/jsm/tsl/utils/HierarchicalHashedWeyl.js returns four values with seeds seed·4 + k + 1 and steps R4_STEPS[k].

What each part contributes

Each part switched off in turn on the CPU harness (static flat field, RMSE ×1000). The ratio is without ÷ with: above 1 means the part helps on that metric; below 1, in the rows marked cost, means it costs. The per-value steps and the Weyl step are the largest effects by far; the hierarchy's benefit for two or more values fades after the first frame; the scramble costs about 16% on one-value small-kernel error and flicker; the tile phase is nearly redundant once the scramble is present. Details are on the Results page.

What it guarantees

What it does not guarantee

Where the ingredients come from

No individual ingredient is new.

Cost

Four hashes and about 100 integer operations (17 multiplies) per value; no branches, no texture, no memory access. That is roughly 20 times the arithmetic of interleaved gradient noise and four times the hashes of a plain hash with the same steps. Measured at 1920×1080 on an Apple M3 there was no measurable frame-rate change against the previous samplers (94.1 against 94.9 fps for VXGI, 72.8 against 74.2 fps for SSR, on a GPU shared with other work).