spike(hdr): extended-range HDR canvas output behind ?hdr#497
Open
rulkens wants to merge 2 commits into
Open
Conversation
The renderer already works in HDR internally (rgba16float offscreen) and
tone-maps to an 8-bit swap chain in one final compositor pass. This spike
lets that signal reach an HDR display:
- device.ts: when ?hdr is set AND the display reports (dynamic-range: high),
the swap chain becomes rgba16float + toneMapping { mode: 'extended' }.
Off by default; SDR path byte-identical. Threads `hdr` through GpuContext
→ EngineGpuHandles → ReadyFrameContext.
- compositor: two free uniform lanes (bytes 24/28) carry hdrKneeStart +
hdrHeadroom; the tone pass spills over-white energy above the knee back
on top of the clamped curve so bright sources punch into headroom. With
headroom 0 (SDR) the output is unchanged.
- renderFrame: sets headroom/knee from ctx.hdr; constants tunable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Captures what the ?hdr spike investigation surfaced: six incompatible per-layer brightness "currencies" (galaxies/stars/planets/Sun/Milky Way) under one static exposure, and how Gaia Sky / SpaceEngine / Stellarium solve multi-scale viewing with scene-adaptive auto-exposure on a shared magnitude scale. Adds the docs/backlog detail file + a terse BACKLOG index line under Rendering. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
skymap | a6146c6 | Commit Preview URL Branch Preview URL |
Jul 23 2026, 10:14 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Exploratory spike proving skymap can drive an HDR display. The renderer already works in HDR internally (every pass draws into an
rgba16floatoffscreen); a single final compositor pass tone-maps down to an 8-bit swap chain and clamps to[0,1]. This spike lets that signal reach the display.Gated behind
?hdr+ a(dynamic-range: high)display check — off by default, and the SDR path is bit-identical when the flag is off.device.ts: when engaged, the swap chain becomesrgba16float+toneMapping: { mode: 'extended' }(Chrome HDR-canvas API).formatis the single source of truth threaded to every swap-target renderer, so it propagates with no other wiring.hdris threadedGpuContext → EngineGpuHandles → ReadyFrameContext.hdrKneeStart+hdrHeadroom; the tone pass spills over-white energy above the knee on top of the clamped curve, so bright sources (Sun, bloom, bright stars) punch into headroom.hdrHeadroom = 0(SDR) adds nothing.renderFrame.ts: sets headroom/knee fromctx.hdr;HDR_KNEE_START/HDR_HEADROOMare tunable constants.How to test
Open with
?hdron an HDR display (Chrome, OS HDR on). Bright sources should punch past paper-white; mid-range looks identical to SDR. Without?hdror on an SDR display it silently falls back — no visible change, no wasted allocation.Tuning knobs (HMR-hot,
src/services/engine/frame/renderFrame.ts):HDR_HEADROOM(default 0.25) andHDR_KNEE_START(default 1.0).Status
Spike, visually confirmed on an HDR display — looks good. Verified: typecheck clean (both tsconfigs), full suite green (4982 tests), SDR path bit-identical.
The investigation this spike seeded — how brightness should be rebalanced across all six layers, and how other explorers (Gaia Sky / SpaceEngine / Stellarium) handle multi-scale viewing with auto-exposure — is written up in
docs/backlog/2026-07-23-hdr-brightness-rebalance.mdwith aneeds-designbacklog entry. That larger design is deliberately out of scope here.🤖 Generated with Claude Code