[PR #2705] [MERGED] HDR: light sources shine by the kind of light, not its level #4554

Closed
opened 2026-11-03 04:18:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2705
Author: @senjinthedragon
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: hdr-tiers


📝 Commits (10+)

  • 9da81f9 Merge remote-tracking branch 'origin/main' into hdr-tiers
  • 58f2ea7 HDR: light sources shine by the kind of light, not its level
  • 523dd49 Merge remote-tracking branch 'origin/main' into hdr-tiers
  • fbab7d2 Merge remote-tracking branch 'origin/main' into hdr-tiers
  • 113d694 HDR: very bright lifts over bright's window, a step above bright
  • f52e94c docs: glowing particles shine in HDR now; translucent blocks don't yet
  • 2f13cb3 HDR: bright lifts from darker pixels
  • 41d3890 Revert "HDR: bright lifts from darker pixels"
  • 84d4907 Merge remote-tracking branch 'origin/main' into hdr-tiers
  • 73558e3 Merge main into hdr-tiers: keep #3145's black level beside the light tiers

📊 Changes

10 files changed (+215 additions, -42 deletions)

View changed files

📝 crates/horizon-client-render/src/entity.wgsl (+13 -1)
📝 crates/horizon-client-render/src/gfx.rs (+18 -0)
📝 crates/horizon-client-render/src/gfx/hdr.rs (+64 -7)
📝 crates/horizon-client-render/src/hdr.wgsl (+31 -17)
📝 crates/horizon-client-render/src/mesher.rs (+54 -10)
📝 crates/horizon-client-render/src/mesher/fluid.rs (+5 -2)
📝 crates/horizon-client-render/src/mesher/visibility_tests.rs (+1 -0)
📝 crates/horizon-client-render/src/particles.rs (+22 -1)
📝 crates/horizon-client-render/src/terrain.wgsl (+4 -3)
📝 docs/graphics.md (+3 -1)

📄 Description

🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin.

What and why

Follows #2021, part of #1441. Builds on #2638 (the vignette fix touches the same lines of hdr.wgsl); its
commit shows here until it is merged.

HDR's highlights went by a light source's light level, but the level says how far a source lights its
surroundings, not how bright it looks: a candle's flame is as bright as a torch's, it only lights less around
it. Light sources now shine by the kind of light instead.

  • Tiers (mesher::hdr_tier), written into TerrainVertex::color's emission bits where the level was:

    Tier Blocks
    very bright the sun (celestial pipeline, as before)
    bright glowstone, jack o'lantern, campfires, soul lantern, soul torch, soul fire
    incandescent torch, lantern, lava, fire, crying obsidian, sea lantern
    low redstone torch, magma, candles (the wick; the flame is a particle)
    none glow lichen: a faint glow in the dark, as in SDR

    Blocks not in the table (modded ones, and vanilla ones not yet looked at) go by their level: 10 and up
    incandescent, below that low.

  • Each tier has its own share of the headroom and its own lift window (gfx/hdr.rs TIERS), so a blue or
    red source can start lifting at a lower brightness than a white one. The values were tuned by eye in game,
    block by block, on the display below.

  • Particles: flames (torch, soul, copper, candle), lava pops and drops, and obsidian tears shine too. Their
    tier rides in the particle vertex's overlay bits 16 and up (vs_entity masks them off); with HDR on, a
    second draw of the entity range (fs_hdr_mark, alpha writes only) marks those pixels in the frame's alpha, so
    their colour still blends as before. Smoke and other particles are untouched. Translucent-layer particles
    keep overlay 15 exactly, as EntityBatch buckets by it.

  • HORIZON_HDR_DEBUG=1 now greys what isn't lifted and tints what is, so a lift shows on purple and red
    light too (crying obsidian, redstone torches were invisible under the old magenta).

Shader packs: pack_entities reads a run's overlay only through entity_color, where the high bits fall in
the same arm as overlay 0, and passes a fixed vaUV1; nothing changes for packs.

Vanilla reference

Horizon-only. HDR stays off by default; with it off nothing changes (the extra draw only runs with HDR on).

Self-check

pr_ready (tools/pr_ready.py --quick, against origin/main at 4af2c671)

Check Result
Scope ✅ 10 files, +221 −45 (with #2638's +9 −5)
rustfmt ✅
clippy ✅
tests: horizon-client ✅ 1304 passed (new: light_sources_shine_by_kind_not_light_level, hdr_shaders_validate, which parses and validates hdr.wgsl, terrain.wgsl and entity.wgsl with naga)
doc tests ✅

Testing

Linux, KWin 6.8.1 (HDR, SDR brightness 430 nits), NVIDIA RTX 2080, Alienware AW3423DW (HDR 1000 mode), HDR10,
Paper White 200, Peak 500. Tuned with live keys in a local build (not in this PR): each tier's share and window,
and each block's tier, looked at side by side at night and in a dark room.

  • Torch tip and flames, lantern, lava, glowstone: as before or close to it.
  • Candle: now glows through its flame particle; before, nothing lifted.
  • Soul lantern/torch, crying obsidian: lift where before they barely did; their blue/purple still lifts less
    than white, as intended.
  • Glow lichen stays SDR (even the lowest tier looked too bright for it).
  • Campfire fire and its particles at about the same brightness; smoke stays SDR.

Known limits, for later: a block's top lifts more than its sides (vanilla's face shading is baked into the
colour before the HDR pass), and a texture's glowing pixels can't be told from its other bright ones (a
jack o'lantern's skin, a soul lantern's frame). Both want per-texture emission (LabPBR _s maps), not this.

Screenshots

HDR can't be shown in an SDR screenshot.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2705 **Author:** [@senjinthedragon](https://github.com/senjinthedragon) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hdr-tiers` --- ### 📝 Commits (10+) - [`9da81f9`](https://github.com/horizon-rust/horizon/commit/9da81f9293a1b731b204096a6d6630c7916c37b8) Merge remote-tracking branch 'origin/main' into hdr-tiers - [`58f2ea7`](https://github.com/horizon-rust/horizon/commit/58f2ea700e52746706d3d72596e39b4211137718) HDR: light sources shine by the kind of light, not its level - [`523dd49`](https://github.com/horizon-rust/horizon/commit/523dd491c49112868a5c2cf892848301fe9975cf) Merge remote-tracking branch 'origin/main' into hdr-tiers - [`fbab7d2`](https://github.com/horizon-rust/horizon/commit/fbab7d29a58721eed537430c09494dda024b165d) Merge remote-tracking branch 'origin/main' into hdr-tiers - [`113d694`](https://github.com/horizon-rust/horizon/commit/113d694a87d2c0d23d61ea94af429a80ab5751de) HDR: very bright lifts over bright's window, a step above bright - [`f52e94c`](https://github.com/horizon-rust/horizon/commit/f52e94cfb92a17748f08ec3bf1933e27888fe833) docs: glowing particles shine in HDR now; translucent blocks don't yet - [`2f13cb3`](https://github.com/horizon-rust/horizon/commit/2f13cb3ac60cfed0a24f6a30b532fce152ee1b8e) HDR: bright lifts from darker pixels - [`41d3890`](https://github.com/horizon-rust/horizon/commit/41d3890a3c3983b215a64976e9889434ed90c152) Revert "HDR: bright lifts from darker pixels" - [`84d4907`](https://github.com/horizon-rust/horizon/commit/84d49077c09f7991645886291c04428af47ba7ae) Merge remote-tracking branch 'origin/main' into hdr-tiers - [`73558e3`](https://github.com/horizon-rust/horizon/commit/73558e3673f9f75496a0dcd8b0ec48c1cf10a08e) Merge main into hdr-tiers: keep #3145's black level beside the light tiers ### 📊 Changes **10 files changed** (+215 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/entity.wgsl` (+13 -1) 📝 `crates/horizon-client-render/src/gfx.rs` (+18 -0) 📝 `crates/horizon-client-render/src/gfx/hdr.rs` (+64 -7) 📝 `crates/horizon-client-render/src/hdr.wgsl` (+31 -17) 📝 `crates/horizon-client-render/src/mesher.rs` (+54 -10) 📝 `crates/horizon-client-render/src/mesher/fluid.rs` (+5 -2) 📝 `crates/horizon-client-render/src/mesher/visibility_tests.rs` (+1 -0) 📝 `crates/horizon-client-render/src/particles.rs` (+22 -1) 📝 `crates/horizon-client-render/src/terrain.wgsl` (+4 -3) 📝 `docs/graphics.md` (+3 -1) </details> ### 📄 Description > 🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin. ## What and why Follows #2021, part of #1441. **Builds on #2638** (the vignette fix touches the same lines of `hdr.wgsl`); its commit shows here until it is merged. HDR's highlights went by a light source's light level, but the level says how far a source lights its surroundings, not how bright it looks: a candle's flame is as bright as a torch's, it only lights less around it. Light sources now shine by the kind of light instead. - **Tiers** (`mesher::hdr_tier`), written into `TerrainVertex::color`'s emission bits where the level was: | Tier | Blocks | | --- | --- | | very bright | the sun (celestial pipeline, as before) | | bright | glowstone, jack o'lantern, campfires, soul lantern, soul torch, soul fire | | incandescent | torch, lantern, lava, fire, crying obsidian, sea lantern | | low | redstone torch, magma, candles (the wick; the flame is a particle) | | none | glow lichen: a faint glow in the dark, as in SDR | Blocks not in the table (modded ones, and vanilla ones not yet looked at) go by their level: 10 and up incandescent, below that low. - **Each tier has its own share of the headroom and its own lift window** (`gfx/hdr.rs` `TIERS`), so a blue or red source can start lifting at a lower brightness than a white one. The values were tuned by eye in game, block by block, on the display below. - **Particles:** flames (torch, soul, copper, candle), lava pops and drops, and obsidian tears shine too. Their tier rides in the particle vertex's overlay bits 16 and up (`vs_entity` masks them off); with HDR on, a second draw of the entity range (`fs_hdr_mark`, alpha writes only) marks those pixels in the frame's alpha, so their colour still blends as before. Smoke and other particles are untouched. Translucent-layer particles keep overlay 15 exactly, as `EntityBatch` buckets by it. - **`HORIZON_HDR_DEBUG=1`** now greys what isn't lifted and tints what is, so a lift shows on purple and red light too (crying obsidian, redstone torches were invisible under the old magenta). Shader packs: `pack_entities` reads a run's overlay only through `entity_color`, where the high bits fall in the same arm as overlay 0, and passes a fixed `vaUV1`; nothing changes for packs. ## Vanilla reference Horizon-only. HDR stays off by default; with it off nothing changes (the extra draw only runs with HDR on). ## Self-check **pr_ready** (`tools/pr_ready.py --quick`, against origin/main at 4af2c671) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +221 −45 (with #2638's +9 −5) | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ 1304 passed (new: `light_sources_shine_by_kind_not_light_level`, `hdr_shaders_validate`, which parses and validates `hdr.wgsl`, `terrain.wgsl` and `entity.wgsl` with naga) | | doc tests | ✅ | ## Testing Linux, KWin 6.8.1 (HDR, SDR brightness 430 nits), NVIDIA RTX 2080, Alienware AW3423DW (HDR 1000 mode), HDR10, Paper White 200, Peak 500. Tuned with live keys in a local build (not in this PR): each tier's share and window, and each block's tier, looked at side by side at night and in a dark room. - Torch tip and flames, lantern, lava, glowstone: as before or close to it. - Candle: now glows through its flame particle; before, nothing lifted. - Soul lantern/torch, crying obsidian: lift where before they barely did; their blue/purple still lifts less than white, as intended. - Glow lichen stays SDR (even the lowest tier looked too bright for it). - Campfire fire and its particles at about the same brightness; smoke stays SDR. Known limits, for later: a block's top lifts more than its sides (vanilla's face shading is baked into the colour before the HDR pass), and a texture's glowing pixels can't be told from its other bright ones (a jack o'lantern's skin, a soul lantern's frame). Both want per-texture emission (LabPBR `_s` maps), not this. ## Screenshots HDR can't be shown in an SDR screenshot. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:18:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4554
No description provided.