[PR #3482] [MERGED] Light reads the chunk's column: flood fill, layers and relighting span its sections #5011

Closed
opened 2026-11-03 05:09:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3482
Author: @ThatCakeIsAPie
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111

Base: main ← Head: feat/level-shape-3


📝 Commits (5)

  • 46c62bd LevelShape: each level's shape as one value, and the column its chunks hold
  • a6d8409 Light reads the chunk's column: flood fill, layers and relighting span its sections
  • bc3383d Merge remote-tracking branch 'origin/main' into pt1-3481
  • 536c3b9 LevelShape helpers are pub, and for_dir sits beside the type
  • c18e893 Merge branch 'pt1-3481' into pt1-3482

📊 Changes

4 files changed (+408 additions, -91 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+274 -18)
📝 crates/horizon-client-render/src/chunk_map.rs (+3 -0)
📝 crates/horizon-client-render/src/light.rs (+130 -27)
📝 crates/horizon-client/src/save.rs (+1 -46)

📄 Description

🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself.

Builds on #3481 (feat/level-shape-2): until that merges, its commits show here too; this PR's own change is the commit(s) on top.

What and why

Part 3 of the level-shape series: each level's chunks hold the column its dimension type gives them (part 2: LevelShape::column). Light still assumed the fixed -64..320 column. Now it reads the chunk's own column:

  • light_chunk floods up to the centre chunk's own top (sections.len() * 16) and returns a light per section of it. light_from_layers and update_light_layers (saved and received light) span the chunk's sections.
  • The incremental relighter (relight, Region) keys sections by index in the column of the world it lights. LightWorld::layout is the column the world's chunks hold. The sky-source scan (lowest_sky_source) and the sky reseeding run from that column's top to its bottom.
  • LightChanges counts section indexes in that column, so a change near the top of a taller level dirties the right sections and its neighbours (dirty_sections bounds them by the column).
  • Chunk::layout() gives a chunk's column.

Vanilla's column is unchanged, so its light is unchanged.

Open PRs nearby: #3256, #3257 and #3263 edit nearby lines of light.rs. The overlap is in text only, not in what they do; whichever lands second needs a rebase.

Vanilla reference

LevelLightEngine / LightEngine and ChunkSkyLightSources read LevelHeightAccessor's getMinSectionY / getMaxSectionY (here, the chunk's column), and SectionPos keys count from the level's minimum section.

Self-check

Tests

  • a_tall_column_is_lit_to_its_top: a 131-section chunk (-64..2032) with a stone roof at y 1600 and a torch at 1500 is lit to its top: 131 lights, block light around the torch, full sky above the roof, none under it.
  • a_tall_column_relights_as_its_full_light_and_keys_its_sections: edits at y 1800-2020 in a tall 3 x 3 world, relit incrementally, match a full light_chunk. The change at y 2020 is keyed as section 130, and every dirtied section is inside the column.
  • The existing light tests run on the vanilla column, unchanged.

python3 tools/test_light_parity.py (DESKTOP-LT6RAH8, 10 min 36 s): vanilla 26.3 lights its scene (slabs, stairs, snow, trapdoors, lanterns, glass, leaves, water, glowstone), and Horizon relights every saved chunk.

1179648 values compared: 0 sky and 0 block light values differ
100 edits: 0 light values differ from a full relight
light parity ok

(On Windows the vanilla server logs a Perflib performance-counter error at start, which vanilla_world_check.py counts as a problem. For this run its benign list was extended locally to skip those lines. Not part of this PR.)

Run before this branch was rebased from upstream/main 56f968e11 onto fe3333f3f. After the rebase, CI's two clippy commands pass on it again, and pr_ready was re-run at the top of its series (#3490).

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at 56f968e11, 13 min 16 s)

Check Result
Scope ⚠️ 15 files, +698 −199; 897 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 398 run, FAILED (failures=2, errors=8, skipped=1) (1 min 36 s)
rustfmt ✅ (21 s)
clippy ✅ (1 min 14 s)
tests: horizon-client ❌ 1100 passed, 2 failed (8 min 55 s)
doc tests ✅ 0 passed (1 min 6 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The Scope row counts the whole stack against upstream main; this PR's own part (over feat/level-shape-2) is 3 files, +140 −27, 167 lines of code.

The Python tests fail on upstream main on this Windows machine too, more often there (main 56f968e11: failures=3, errors=13; path separators, symlink privilege). CI runs them on Linux.

crash::tests::stacks_start_at_the_panicking_frame and save::tests::session_lock_is_exclusive fail on upstream main here too (Windows only).

Suggested label: skip-release.

🤖 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/3482 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/level-shape-3` --- ### 📝 Commits (5) - [`46c62bd`](https://github.com/horizon-rust/horizon/commit/46c62bdf2a307b633d1ba6ea32b471ec0316c6d9) LevelShape: each level's shape as one value, and the column its chunks hold - [`a6d8409`](https://github.com/horizon-rust/horizon/commit/a6d8409466af6393be67ad2bf3a86b2fe8165906) Light reads the chunk's column: flood fill, layers and relighting span its sections - [`bc3383d`](https://github.com/horizon-rust/horizon/commit/bc3383d1bfd77ab68ddb6c22d14e6ff826f74468) Merge remote-tracking branch 'origin/main' into pt1-3481 - [`536c3b9`](https://github.com/horizon-rust/horizon/commit/536c3b90fd77a059d46a93b6ccecbe1f216cd307) LevelShape helpers are pub, and for_dir sits beside the type - [`c18e893`](https://github.com/horizon-rust/horizon/commit/c18e893143f91b995c89c471432a99dab5eacc81) Merge branch 'pt1-3481' into pt1-3482 ### 📊 Changes **4 files changed** (+408 additions, -91 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+274 -18) 📝 `crates/horizon-client-render/src/chunk_map.rs` (+3 -0) 📝 `crates/horizon-client-render/src/light.rs` (+130 -27) 📝 `crates/horizon-client/src/save.rs` (+1 -46) </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. **Builds on #3481 (`feat/level-shape-2`)**: until that merges, its commits show here too; this PR's own change is the commit(s) on top. ## What and why Part 3 of the level-shape series: each level's chunks hold the column its dimension type gives them (part 2: `LevelShape::column`). Light still assumed the fixed `-64..320` column. Now it reads the chunk's own column: - `light_chunk` floods up to the centre chunk's own top (`sections.len() * 16`) and returns a light per section of it. `light_from_layers` and `update_light_layers` (saved and received light) span the chunk's sections. - The incremental relighter (`relight`, `Region`) keys sections by index in the column of the world it lights. `LightWorld::layout` is the column the world's chunks hold. The sky-source scan (`lowest_sky_source`) and the sky reseeding run from that column's top to its bottom. - `LightChanges` counts section indexes in that column, so a change near the top of a taller level dirties the right sections and its neighbours (`dirty_sections` bounds them by the column). - `Chunk::layout()` gives a chunk's column. Vanilla's column is unchanged, so its light is unchanged. **Open PRs nearby:** #3256, #3257 and #3263 edit nearby lines of `light.rs`. The overlap is in text only, not in what they do; whichever lands second needs a rebase. ## Vanilla reference `LevelLightEngine` / `LightEngine` and `ChunkSkyLightSources` read `LevelHeightAccessor`'s `getMinSectionY` / `getMaxSectionY` (here, the chunk's column), and `SectionPos` keys count from the level's minimum section. ## Self-check **Tests** - `a_tall_column_is_lit_to_its_top`: a 131-section chunk (`-64..2032`) with a stone roof at y 1600 and a torch at 1500 is lit to its top: 131 lights, block light around the torch, full sky above the roof, none under it. - `a_tall_column_relights_as_its_full_light_and_keys_its_sections`: edits at y 1800-2020 in a tall 3 x 3 world, relit incrementally, match a full `light_chunk`. The change at y 2020 is keyed as section 130, and every dirtied section is inside the column. - The existing light tests run on the vanilla column, unchanged. `python3 tools/test_light_parity.py` (DESKTOP-LT6RAH8, 10 min 36 s): vanilla 26.3 lights its scene (slabs, stairs, snow, trapdoors, lanterns, glass, leaves, water, glowstone), and Horizon relights every saved chunk. ``` 1179648 values compared: 0 sky and 0 block light values differ 100 edits: 0 light values differ from a full relight light parity ok ``` (On Windows the vanilla server logs a `Perflib` performance-counter error at start, which `vanilla_world_check.py` counts as a problem. For this run its benign list was extended locally to skip those lines. Not part of this PR.) Run before this branch was rebased from upstream/main 56f968e11 onto fe3333f3f. After the rebase, CI's two clippy commands pass on it again, and pr_ready was re-run at the top of its series (#3490). **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at 56f968e11, 13 min 16 s) | Check | Result | | --- | --- | | Scope | ⚠️ 15 files, +698 −199; 897 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 398 run, FAILED (failures=2, errors=8, skipped=1) (1 min 36 s) | | rustfmt | ✅ (21 s) | | clippy | ✅ (1 min 14 s) | | tests: horizon-client | ❌ 1100 passed, 2 failed (8 min 55 s) | | doc tests | ✅ 0 passed (1 min 6 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The Scope row counts the whole stack against upstream main; this PR's own part (over `feat/level-shape-2`) is 3 files, +140 −27, 167 lines of code. The Python tests fail on upstream main on this Windows machine too, more often there (main 56f968e11: failures=3, errors=13; path separators, symlink privilege). CI runs them on Linux. `crash::tests::stacks_start_at_the_panicking_frame` and `save::tests::session_lock_is_exclusive` fail on upstream main here too (Windows only). Suggested label: `skip-release`. 🤖 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 05:09:35 +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#5011
No description provided.