Tracker: HDR color support

Open
#11,146 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Read the completed compatibility groundwork and the linked changes #11130, #11139, #11137, and #11141 to understand the current color normalization pilot. Start with one unchecked audit item, tracing the named layers, props, or rendering paths in the repository. Done means the relevant color handling is covered while preserving the stated byte, alpha, picking, and encoding behavior; the broader tracker also calls for HDR contracts, render tests, and documentation.

Written by the indexing model from the issue text.

Description

Compatibility groundwork

  • Centralize normalization for bitmap and text uniforms, highlights, lighting, clear colors, and palettes while retaining byte inputs (#11130).
  • Identify Scatterplot fill and line as semantic colors and share defaults between constants and callbacks (#11139).
  • Add typed-aware luma.gl normalization helpers with opaque alpha fallback and float-array pass-through (visgl/luma.gl#3771).
  • Upgrade deck.gl to the luma.gl release containing the helpers (#11137).
  • Land the Deck-only normalizedColors pilot for ScatterplotLayer, LineLayer, and ArcLayer (#11141).

Complete 0–1 input support

  • Support normalized TextLayer glyph, background, and border colors (#11164).

  • Support normalized SimpleMeshLayer and ScenegraphLayer instance colors (#11162).

  • Support normalized IconLayer, PointCloudLayer, and ColumnLayer color accessors (#11161).

  • Support normalized PathLayer, PolygonLayer, and SolidPolygonLayer colors, including fills, strokes, and wireframes (#11160).

  • Audit color accessors and color uniforms across remaining built-in layers, including paths, polygons, points, text, icons, bitmap, and meshes. Cover constants, callbacks, and RGB/RGBA defaults.

  • Pilot normalized GeoJsonLayer color accessors while preserving child byte defaults (#11157).

  • Extend the GeoJsonLayer approach to other composites such as PolygonLayer, TextLayer, and tiled layers (#11170). Preserve byte defaults and convert user input once.

  • Support normalized BitmapLayer tint and transparency and TextLayer outlines, including transitions (#11156).

  • Support normalized constant and callback highlights independently of picking ID encoding (#11155).

  • Support normalized View clear colors, including omitted alpha, explicit zero alpha, and picking passes. Preserve the legacy byte fallback (#11149).

  • Honor explicit zero alpha in legacy byte-mode View clears and document the compatibility change (#11153).

  • Support normalized TerrainLayer and Tile3DLayer colors (#11166).

  • Support normalized CARTO HeatmapTileLayer palettes (#11165).

  • Audit aggregation and CARTO palettes, contour colors, and texture packing (#11168). Preserve palette alpha and existing explicit binary formats.

  • Audit extension color defaults and generated values, starting with FillStyleExtension (#11167). Preserve mask, filter, and collision encodings.

  • Audit lighting and effects, including ambient, directional, and point lights, and already normalized shadow colors (#11171).

  • Verify Arrow/SQL fallback accessors, byte typed arrays, binary and GPU columns, and live Deck toggles on WebGL and WebGPU. Verify color attribute interpolation on WebGL (#11172).

  • Document supported inputs, coverage by layer and prop, and the migration from plain byte arrays (#11172).

HDR rendering plan

The normalized-color pilot accepts 0–1 input for existing SDR paths and still packs color attributes and palettes into bytes. HDR adds a scene-linear rendering path, higher-precision storage where requested, and an output transform. Keep those concerns independent so applications can adopt HDR rendering with tone-mapped SDR output.

1. Specify the API and color contract
  • Write an RFC that separates input encoding, working color space, storage precision, and output mode. Leave normalizedColors as the existing byte-versus-unit-array convention. Propose an explicit opt-in for scene-linear rendering and a separate way to declare linear float inputs. Decide the public option names after the prototype.
  • Start with linear sRGB primaries and D65. Decode sRGB-encoded display colors once before interpolation, lighting, and blending. Document which current sources are sRGB, linear, or data, including accessor colors, clear and highlight colors, palettes, bitmap/icon textures, glTF base color and emissive textures, and numerical render targets. Keep alpha linear.
  • Define 1.0 as reference white and allow finite RGB above 1. Keep alpha in 0–1, with missing alpha equal to 1 and explicit zero preserved. Specify rejection or sanitization of non-finite inputs, whether negative RGB is allowed in v1, and how values beyond the selected storage range are handled.
  • Specify straight-alpha inputs and premultiplied scene compositing. Require a single premultiplication boundary, preserve transparent black, and record output alpha conventions for opaque canvases, transparent canvases, and application-owned targets.
  • Set compatibility rules. Existing Deck configurations keep their SDR pipeline and appearance. Explicit byte, binary, Arrow, and GPU buffers keep their declared formats. Picking IDs, masks, terrain heights, collision textures, and aggregation weights retain their numeric interpretation.
  • Publish conformance vectors for transfer functions, reference white, alpha, invalid values, and examples mixing legacy sRGB colors with scene-linear HDR values.
2. Prove the renderer path with one layer
  • Build an experimental ScatterplotLayer or minimal test layer path that draws RGB values above 1 into an offscreen rgba16float target. Read pixels before output conversion to verify that the fragment output, attachment, and blend pipeline preserve bright values.
  • Trace ownership through DeckRenderer, LayersPass, ScreenPass, CanvasManager, and luma.gl presentation contexts. Define who allocates, resizes, clears, resolves multisampling, and destroys scene color and depth targets. Handle external framebuffers, multiple views and canvases, resize, device pixel ratio, and device loss.
  • Probe each backend for renderability, blending, filtering, texture copies/readback, and sample-count support with the actual target format. For WebGL, check float color buffer extension support and validate framebuffer completeness and blending on device. Keep capability failures separate from display HDR availability.
  • Make the first end-to-end milestone WebGPU scene-linear offscreen rendering with tone-mapped SDR output. Evaluate WebGL offscreen parity independently. Record the behavior when a float scene target cannot be used and surface the effective output mode to the app.
3. Preserve precision at input and storage boundaries
  • Add explicit float color storage for constants and callbacks. Prototype float32 for correctness, then evaluate float16 for vertex attributes and palette textures where format and backend support justify it. Existing compact unorm8x4 storage remains available.
  • Audit semantic color packing, attribute defaults, grouped buffers, shader layouts, and composite forwarding. Verify that toggling modes invalidates affected attributes and models without re-fetching data. Handle scalar constants, instanced and per-vertex colors, callbacks, and explicit buffer layouts.
  • Define float column contracts for Arrow/SQL and GPU inputs. Test format/stride validation, RGB-to-RGBA expansion, null/default handling, and buffer ownership. Preserve caller-owned buffers and existing typed byte semantics.
  • Put float palette entries into a float texture and interpolate in linear light. Cover contour colors, CPU/GPU aggregation palettes and CARTO palettes. Test opaque fallback alpha, explicit transparent entries, and fallback filtering when a backend cannot filter the chosen format.
  • Audit attribute and uniform transitions. Interpolate scene-linear values without byte repacking. Track WebGPU attribute-transition parity as a dependency on the corresponding transform or compute implementation.
  • Expand support by layer family after the pilot. Cover polygon/path/point/column colors, text and icon tint, bitmap sources, mesh materials and lights, extension-generated colors, and tiled composites. Record coverage and exclusions in public docs.
4. Composite and apply effects in linear light
  • Implement source-over in the scene target with premultiplied RGB and linear alpha. Update layer blend states and shader output conventions together. Audit additive modes, custom parameters, depth ordering, antialiasing coverage, and multisample resolves.
  • Audit lighting, highlights, clear colors, text/bitmap tint, PBR emissive contributions, fog and postprocessing. Convert only color inputs. Keep normals, roughness, depth, masks and picking textures outside the output transform.
  • Define effect execution order and the format/color-space contract for each pass. Scene effects such as exposure or bloom can use extended values. Specify how display-space overlays and legacy effects are supported or excluded.
  • Add readback assertions for two overlapping translucent layers, zero alpha, highlight and clear colors, and effects retaining values above 1 in intermediate targets. Check a controlled blend against the CPU reference formula.
5. Add output transforms and platform presentation
  • Implement a final scene-to-output pass with documented reference white, exposure in stops, tone mapper, transfer function, and output alpha handling. Use one transform for the scene and avoid double encoding at sRGB attachments or browser presentation. Include a deterministic SDR path with regression fixtures.
  • Add native HDR canvas presentation on WebGPU only after validating luma.gl support. Probe float canvas configuration and extended tone mapping, verify the configured mode, and separate browser capability from OS/display output. Treat wide-gamut output as its own decision.
  • Define fallback order. Fall back from native HDR presentation to tone-mapped SDR while preserving the float scene where supported. If the device cannot render and blend a float scene target, use the existing SDR path and expose the effective mode. Keep caller-owned offscreen targets explicit.
  • Verify transparent composition and basemap integrations. Check shared map contexts, overlaid canvases, canvas snapshots/export, multiple presentation targets, and independent view clears. Establish which combinations ship in the first release.
6. Validate and ship in dependency order
  • Land separate PRs in this order. Contract and conformance vectors, experimental offscreen pipeline and SDR output, float accessors and palettes, premultiplied blending and effect audit, native HDR presentation, then broader layer coverage and migration docs. Split luma.gl changes from Deck API changes and link their upstream PRs.
  • Run automated shader and framebuffer readback tests on WebGPU and WebGL where supported. Test bright ramps, sub-byte gradients, alpha edges, overlapping layers, depth/AA, color-mode toggles, byte and explicit buffers, palettes, resize, cleanup, and forced fallback.
  • Keep CI assertions on numerical buffers and deterministic SDR images. Validate actual HDR presentation separately on supported OS/browser/display combinations and an SDR display. Record effective render mode, canvas configuration, and reproduction steps. Ordinary screenshots alone cannot establish display HDR.
  • Measure memory, bandwidth, frame time, buffer uploads, and reconfiguration on representative scatterplot and polygon data. Compare byte versus float storage and full-resolution scene targets. Gate rollout on existing SDR fixtures passing and no float allocations on the default SDR path.
  • Ship an example with an HDR ramp, a lit/emissive object, translucent overlays, and an SDR preview. Document setup, capability reporting, alpha/transfer assumptions, compatibility, and layer coverage. Update the tracker as each measurable milestone lands.

Primary references for backend capability work: WebGPU specification and Khronos EXT_color_buffer_float.

Dominant language
TypeScript
Stars
14.8k
Forks
2.3k
Avg merge
1d 9h
Merged PRs (30d)
230

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from visgl/deck.gl

All issues in visgl/deck.gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.