v137 · graphics

Canvas Floating Point Color Types

Introduce the the ability to use floating point pixel formats (as opposed to 8-bit fixed point) with CanvasRenderingContext2D, OffscreenCanvasRenderingContext2D, and ImageData.

concepts

  1. Canvas float color

    Canvas can use floating-point color formats (float16, float32). Required for HDR pipelines and high-precision compositing in 2D contexts.

  2. Exposure Stops

    Sweep a synthetic medical-imaging scene through exposure stops -0 to -14. Counts how many distinct grey codes survive in each canvas — float16 keeps resolving past the point unorm8 has gone all black.

  3. Tonemap Studio

  4. HDR Gradient Builder

    Build a gradient with luminance multipliers above 1.0, render it on both a float16 and a clamped uint8 canvas, then sample specific pixels to compare the actual channel values stored — float16 preserves 2.5×, uint8 clamps to 1.0.

    Interactive HDR tonemap — Reinhard / ACES / linear — applied to three synthetic scenes with bright highlights. Side-by-side uint8 vs float16 canvas plus live luminance histograms.

why it shipped

Floating-point pixel values are the natural representation of pixel data, and allow such features as representing colors in arbitrarily wide gamuts and high dynamic range. Current 2D canvases are limited to representing pixels using 8-bit unsigned integers, for historical reasons.

references