Texel A field guide to 3D techniques

Auto exposure from luminance histogram × Blue-noise dithering

1-bit rendering that meters like a camera. 1-bit or few-level dithered rendering that stays readable from dark caves to bright skies. The luminance histogram built for auto exposure also shapes the dither threshold curve, so dot density spreads across the scene's actual tones.

Open in StudioReproduced2.08× · 0.065 ms

Auto exposure from luminance histogramPost · Real-timein: hdr-imageout: hdr-imagehdr-imageBlue-noise ditheringPost · Real-timein: ldr-image, hdr-image, textureout: ldr-image

Verified proof

reproduced · 2026-11-30texel-arena-seedlicense MIT
Specimen render of Histogram-steered 1-bit blue-noise dithering (left: naive, right: CDF-metered)
Cross-proof specimen. Histogram-steered 1-bit blue-noise dithering (left: naive, right: CDF-metered). Verified WebGL2 proof · 2026-11-30

Split-screen WebGL2 proof comparing naive fixed-threshold 1-bit dithering (left, crushing dark cave shadow and clipping bright sky) against log-luminance CDF histogram-steered blue-noise dithering (right, preserving tone legibility across 8 stops).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · preserves shadow and highlight dot-density legibility across an 8-stop HDR scene using blended log-luminance CDF remapping

Show GLSL proof (34 lines)
const float CDF_BLEND = 0.72; // P
const float EXPOSURE = 1.15; // P
float ign(vec2 p) {
  return fract(52.9829189 * fract(dot(p, vec2(0.06711056, 0.00583715))));
}
float sceneHdr(vec2 uv) {
  // High-contrast cave arch + bright sun disc + shadowed ribbed floor
  float arch = length(vec2(uv.x * 0.9, uv.y - 0.05));
  float sky = smoothstep(0.46, 0.42, arch) * (2.6 + 6.0 * exp(-length(uv - vec2(0.06, 0.16)) * 6.5));
  float wall = smoothstep(0.40, 0.48, arch) * (0.045 + 0.09 * (0.5 + 0.5 * sin(uv.x * 22.0 + sin(uv.y * 9.0))) * exp(-abs(uv.y) * 1.4));
  float bounce = 0.22 * exp(-length(uv - vec2(0.0, -0.32)) * 3.8) * (0.65 + 0.35 * cos(uv.x * 30.0));
  float pulse = 0.75 + 0.25 * sin(iTime * 0.4);
  return max(0.008, (sky + wall + bounce) * pulse * EXPOSURE);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float hdr = sceneHdr(uv);
  // Log-luminance histogram CDF approximation over the 8-stop scene range
  float logL = clamp((log2(hdr) + 6.0) / 9.5, 0.0, 1.0);
  float cdf = smoothstep(0.0, 1.0, pow(logL, 0.78));
  float linearL = clamp(hdr / (1.0 + hdr), 0.0, 1.0);
  bool steered = uv.x > 0.0;
  float target = steered ? mix(linearL, cdf, CDF_BLEND) : clamp(hdr * 0.55, 0.0, 1.0);
  // Dual-octave high-frequency noise proxy for blue-noise threshold
  float n0 = ign(floor(fragCoord.xy));
  float n1 = ign(floor(fragCoord.xy) + vec2(17.0, 31.0));
  float bn = clamp((n0 - n1) * 0.5 + 0.5, 0.0, 1.0);
  float bit = step(bn, clamp(target, 0.04, 0.96));
  vec3 ink = vec3(0.08, 0.09, 0.10);
  vec3 paper = vec3(0.95, 0.94, 0.90);
  vec3 col = mix(ink, paper, bit);
  if (abs(uv.x) < 0.003) col = vec3(0.78, 0.24, 0.16);
  fragColor = vec4(col, 1.0);
}

Why they connect

Auto exposure from luminance histogram consumes the hdr-image, bins log luminance, trims outliers and outputs an exposed hdr-image. Its histogram is kept and turned into a cumulative curve. Blue-noise dithering takes the hdr-image, one of its accepted inputs, and compares each pixel's remapped value against a tiled blue-noise threshold. The remap blends the cumulative curve with a plain exposure curve, so mid-grey dot density sits on the scene median and both shadow and highlight detail still get dots.

How to build it

three.js on WebGPU, or Godot compute. Build the histogram as usual, then take a prefix sum into a 256-entry 1D lookup and blend it with the identity curve by a user parameter, since full equalisation is too harsh. Smooth the lookup over time at the exposure adaptation rate. In the final pass, convert luminance to log space, look up the remapped value, compare with blue noise offset by a golden-ratio step each frame, and output black or white or a small palette. Clamp minimum and maximum dot density so night still looks dark.

Field marks

  1. Equalisation amplifies noise and banding in flat regions.
  2. The curve pumps on camera cuts unless it is reset.
  3. Absolute brightness cues fade, so night can look like day.
  4. Needs compute shaders; WebGL2 needs a reduced-resolution or CPU fallback.

Prior art

No prior art found on 2026-11-29.

Searches run (4)
  • arXiv: all:"dithering" AND all:"histogram equalization" → 0 results
  • GitHub repos: dithering "histogram equalization" → 3 results
  • arXiv: all:"1-bit" AND all:"dithering" AND all:"exposure" → 0 results
  • GitHub repos: 1-bit dithering exposure → 0 results