[PR #3390] [MERGED] Far tiles: with Reduced far detail, approximate wide cells #4949

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3390
Author: @ThatCakeIsAPie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: perf/far-tiles-coarse


📝 Commits (5)

  • d93c3cd Far tiles: one biome per 4x4 columns, a coarser vertical lattice
  • eb5e0bb Far tiles: sample density only around the surface, share 2D planes
  • a1a249e Far tiles: approximate only with Reduced far detail
  • b603db6 Merge remote-tracking branch 'origin/main' into upd/3390
  • 34c5dce Merge main into the branch

📊 Changes

10 files changed (+277 additions, -41 deletions)

View changed files

📝 crates/horizon-client-render/src/lod.rs (+10 -1)
📝 crates/horizon-client-render/src/streaming.rs (+3 -0)
📝 crates/horizon-client/src/save.rs (+3 -0)
📝 crates/horizon-client/src/vanillagen/lod.rs (+18 -10)
📝 crates/horizon-core/src/density/cache.rs (+8 -0)
📝 crates/horizon-core/src/density/mod.rs (+5 -0)
📝 crates/horizon-core/src/density/slice.rs (+48 -15)
📝 crates/horizon-core/src/density/tests.rs (+51 -0)
📝 crates/horizon-world/examples/lod_grid_bench.rs (+13 -2)
📝 crates/horizon-world/src/worldgen/generator.rs (+118 -13)

📄 Description

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

Builds on #3368 (perf/far-tiles-biome-memo): until that merges, its commits show here too; this PR's own change is the last commit(s) on top of it.

What and why

Faster far tiles for players who choose Reduced far detail (FarDetail::Reduced, the existing setting described as "changes the picture"). With the default, Full, tiles are sampled exactly as before. Three commits on top of the per-tile biome memo; the first two add the approximations to lod_grid, the third puts them behind Reduced:

  1. One biome per 4x4 columns, coarser vertical lattice: tiles of 4 blocks a column or wider share one biome per 4x4 of their columns (cells up to 64 blocks wide), taken from the first column asked (its surface's). Painting asks through the biome zoom, which strays into neighbouring quarts, and per quart those strays were most of a tile's climate samples. Cells 32 blocks wide or more interpolate density on a 16-block vertical lattice (32 from 128) instead of 8.
  2. Density only around the surface: each tile finds its surface band on a 64-block lattice made of the fine lattice's points. It then samples the fine lattice from 64 below the lowest surface to 128 above the highest (and above sea level); below the band a column is one span of the default block. Thin parts above an air sample of the coarse lattice (floating islands, overhang lips) can be missed. SamplerContext::with_planes keeps y-fixed slice planes (2D noise, most of a far tile's density work) so the two passes share them; it's opt-in, and only far sampling turns it on.
  3. Only with Reduced: GeneratorWorker::lod_grid takes approximate, and does none of the above without it. LodSampler::set_approximate carries it to the far sampling threads, and Lod::set_reduced_detail sets it, so tiles sampled after a change of setting follow it. lod_grid_bench --approximate samples as Reduced does.

Related to the open roadmap item "far terrain at 48 to 64 chunks" (#718).

Vanilla reference

Horizon-only: vanilla has no far terrain, and it is off by default (lodDistance 0). With Full far detail (the default) nothing changes: lod_grid_bench without --approximate gives the same checksums as the previous PR at every level (tiles and heights). With Reduced, the picture changes as measured below, on top of Reduced's existing coarser tiles.

Measured

Measured against upstream main at 43d8bd01c; the branch is now rebased onto e1b2b0b2f, and upstream hasn't changed the code it touches in between.

lod_grid_bench --approximate (as Reduced samples), vanilla seed 1234, 25 tiles a level, best of 3 interleaved rounds on a quiet machine:

ms a tile upstream main biome memo (previous PR) this branch
level 0 6.6 4.1 3.7
level 2 17.9 16.7 12.7
level 3 17.6 16.5 12.2
level 4 18.7 17.1 13.7
level 6 17.8 16.3 11.9

What Reduced changes against the exact tiles (--dump, 6400 columns a level):

level (blocks a column) surface height differs surface block differs biome differs
2 (4) 0% 0% 2.4%
3 (8) 0% 0% 4.7%
4 (16) 0% 4.3% 23.3%
6 (64) 74.6% (mean 2.7 blocks, max 64) 11.4% 2.7%

With Reduced, tiles are about 30% faster than main at levels 2 to 6 on vanilla. In the 2096-block data pack world this work comes from, the tile cost fell much further (level 2-4 from 46-62 ms to 17-22 ms) and the surface heights stayed the same at every level.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at 3c9bb38e8, 25 min 2 s)

Check Result
Scope ✅ 10 files, +410 −47
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 399 run, FAILED (failures=1, skipped=2) (1 min 52 s)
rustfmt ✅ (13 s)
clippy ✅ (4 min 32 s)
tests: horizon-client, horizon-core, horizon-world ❌ 1107 passed, 1 failed (12 min 44 s)
doc tests ✅ 0 passed (5 min 33 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 Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux. The horizon-client test save::tests::session_lock_is_exclusive fails on Windows on upstream main too (#3088 fixes the session lock test).

🤖 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/3390 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `perf/far-tiles-coarse` --- ### 📝 Commits (5) - [`d93c3cd`](https://github.com/horizon-rust/horizon/commit/d93c3cdd822dc516fd73d80652c294f0c827e2f7) Far tiles: one biome per 4x4 columns, a coarser vertical lattice - [`eb5e0bb`](https://github.com/horizon-rust/horizon/commit/eb5e0bb91473c730b40c143b933b4015b88db41c) Far tiles: sample density only around the surface, share 2D planes - [`a1a249e`](https://github.com/horizon-rust/horizon/commit/a1a249e2f64572a70a90c9dd7bead27074d16255) Far tiles: approximate only with Reduced far detail - [`b603db6`](https://github.com/horizon-rust/horizon/commit/b603db617691353ca6be09d314621b2c27c4384e) Merge remote-tracking branch 'origin/main' into upd/3390 - [`34c5dce`](https://github.com/horizon-rust/horizon/commit/34c5dce056e97ae20ed14604e5a3102130a015f0) Merge main into the branch ### 📊 Changes **10 files changed** (+277 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/lod.rs` (+10 -1) 📝 `crates/horizon-client-render/src/streaming.rs` (+3 -0) 📝 `crates/horizon-client/src/save.rs` (+3 -0) 📝 `crates/horizon-client/src/vanillagen/lod.rs` (+18 -10) 📝 `crates/horizon-core/src/density/cache.rs` (+8 -0) 📝 `crates/horizon-core/src/density/mod.rs` (+5 -0) 📝 `crates/horizon-core/src/density/slice.rs` (+48 -15) 📝 `crates/horizon-core/src/density/tests.rs` (+51 -0) 📝 `crates/horizon-world/examples/lod_grid_bench.rs` (+13 -2) 📝 `crates/horizon-world/src/worldgen/generator.rs` (+118 -13) </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. **Builds on #3368** (`perf/far-tiles-biome-memo`): until that merges, its commits show here too; this PR's own change is the last commit(s) on top of it. ## What and why Faster far tiles for players who choose **Reduced** far detail (`FarDetail::Reduced`, the existing setting described as "changes the picture"). With the default, **Full**, tiles are sampled exactly as before. Three commits on top of the per-tile biome memo; the first two add the approximations to `lod_grid`, the third puts them behind Reduced: 1. **One biome per 4x4 columns, coarser vertical lattice**: tiles of 4 blocks a column or wider share one biome per 4x4 of their columns (cells up to 64 blocks wide), taken from the first column asked (its surface's). Painting asks through the biome zoom, which strays into neighbouring quarts, and per quart those strays were most of a tile's climate samples. Cells 32 blocks wide or more interpolate density on a 16-block vertical lattice (32 from 128) instead of 8. 2. **Density only around the surface**: each tile finds its surface band on a 64-block lattice made of the fine lattice's points. It then samples the fine lattice from 64 below the lowest surface to 128 above the highest (and above sea level); below the band a column is one span of the default block. Thin parts above an air sample of the coarse lattice (floating islands, overhang lips) can be missed. `SamplerContext::with_planes` keeps y-fixed slice planes (2D noise, most of a far tile's density work) so the two passes share them; it's opt-in, and only far sampling turns it on. 3. **Only with Reduced**: `GeneratorWorker::lod_grid` takes `approximate`, and does none of the above without it. `LodSampler::set_approximate` carries it to the far sampling threads, and `Lod::set_reduced_detail` sets it, so tiles sampled after a change of setting follow it. `lod_grid_bench --approximate` samples as Reduced does. Related to the open roadmap item "far terrain at 48 to 64 chunks" (#718). ## Vanilla reference Horizon-only: vanilla has no far terrain, and it is off by default (`lodDistance` 0). With Full far detail (the default) nothing changes: `lod_grid_bench` without `--approximate` gives the same checksums as the previous PR at every level (tiles and heights). With Reduced, the picture changes as measured below, on top of Reduced's existing coarser tiles. ## Measured Measured against upstream main at 43d8bd01c; the branch is now rebased onto e1b2b0b2f, and upstream hasn't changed the code it touches in between. `lod_grid_bench --approximate` (as Reduced samples), vanilla seed 1234, 25 tiles a level, best of 3 interleaved rounds on a quiet machine: | ms a tile | upstream main | biome memo (previous PR) | this branch | |---|---|---|---| | level 0 | 6.6 | 4.1 | 3.7 | | level 2 | 17.9 | 16.7 | 12.7 | | level 3 | 17.6 | 16.5 | 12.2 | | level 4 | 18.7 | 17.1 | 13.7 | | level 6 | 17.8 | 16.3 | 11.9 | What Reduced changes against the exact tiles (`--dump`, 6400 columns a level): | level (blocks a column) | surface height differs | surface block differs | biome differs | |---|---|---|---| | 2 (4) | 0% | 0% | 2.4% | | 3 (8) | 0% | 0% | 4.7% | | 4 (16) | 0% | 4.3% | 23.3% | | 6 (64) | 74.6% (mean 2.7 blocks, max 64) | 11.4% | 2.7% | With Reduced, tiles are about 30% faster than main at levels 2 to 6 on vanilla. In the 2096-block data pack world this work comes from, the tile cost fell much further (level 2-4 from 46-62 ms to 17-22 ms) and the surface heights stayed the same at every level. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at 3c9bb38e8, 25 min 2 s) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +410 −47 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 399 run, FAILED (failures=1, skipped=2) (1 min 52 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (4 min 32 s) | | tests: horizon-client, horizon-core, horizon-world | ❌ 1107 passed, 1 failed (12 min 44 s) | | doc tests | ✅ 0 passed (5 min 33 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 Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux. The horizon-client test `save::tests::session_lock_is_exclusive` fails on Windows on upstream main too (#3088 fixes the session lock test). 🤖 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:07 +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#4949
No description provided.