[PR #6672] [MERGED] Mesher: one-biome sections skip the tint blend #7027

Closed
opened 2026-11-03 06:32:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6672
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/mesh-tint-uniform


📝 Commits (1)

  • 9762e4f Mesher: one-biome sections skip the tint blend

📊 Changes

2 files changed (+164 additions, -1 deletions)

View changed files

📝 crates/horizon-client-render/src/mesher.rs (+50 -1)
➕ crates/horizon-client-render/src/mesher/tint_tests.rs (+114 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part of the client performance wave (chunk section meshing). Stacked on #6535.

Most sections lie inside one biome. There, each block's blended tint is the mean of (2r+1)^2 equal colours, which is that colour. Tints::get now returns it directly. Before, every block ran the eight-corner biome zoom and summed the whole blend square.

How it stays exact

  • The check. Once per section, Tints::uniform_biome reads every quart cell that any block of the section's blend squares can zoom to. quart_at_block picks the block's base cell plus 0 or 1 on each axis, so the check reads the base cells of the section widened by r, plus one cell past them. If all of those hold one biome (missing chunks count as plains, as before), every zoomed cell is that biome.
  • The colours.
    • Grass (plain, or with the dark forest modifier), foliage, dry foliage and water do not depend on position, so the mean is exact.
    • Swamp grass follows noise, so it keeps the full blend.
  • The test. New tint_tests::one_biome_shortcut_blends_like_the_full_square (it needs the prepared resources, like the other mesher geometry tests). It compares the shortcut with the full blend for every block, every resolver, blend radii 0/1/2/5/7, and three heights (column bottom, middle, top). It does this for 7 biomes, each three ways: one biome everywhere, a desert column in the east neighbour, and a missing neighbour. It also checks that the shortcut is taken exactly when the region has one biome.

A/B (chunk_load_bench, seed 1234, radius 8: 4,440 sections per scene, the four perf_bench scenes)

playhorizon (x86-64 VPS, pinned to 4 vCPUs, load ~20-26). Each figure is the mean of 2 pairs. CPU time per section is the best of 3 rounds. "main" is #6502 rebased on main db34ce484d: the bench only, no mesher change.

Scene CPU per section with geometry: main → #6535 → this PR this PR vs #6535 p99 (µs) sections/s per core checksum (all three builds)
village 274.2 → 193.9 → 189.7 µs −2% 701 → 518 → 501 9,563 → 13,726 → 14,009 5f36238a699ae633
forest (-69, -35) 398.8 → 296.7 → 279.2 µs −6% 1,335 → 1,017 → 987 7,075 → 9,590 → 10,173 1c14b8fc4bad6e4c
ocean (-19, -27) 447.9 → 310.4 → 238.9 µs −23% 1,464 → 1,004 → 633 7,424 → 10,787 → 13,913 c5d1ab1a14ba2bd4
mountain (35, 54) 331.0 → 245.6 → 245.0 µs 0% 1,399 → 1,090 → 1,016 5,876 → 8,036 → 8,045 016d55232f7522f4
  • The checksum covers every vertex byte and the visibility graph. It is identical across the three builds in every scene.
  • Vertex bytes are unchanged.
  • Ocean gains the most: its sections are water, tinted per vertex, inside one biome.
  • Mountain gains nothing: its sections cross biome borders (stony peaks, meadows, groves).

Checks

  • On playhorizon (cargo test --release -p horizon-client-render --lib mesher -- --include-ignored, prepared resources): 65 passed. That covers the new tint test, the resource-backed reuse and leaf-culling tests, and the sort tests.
  • Not run by me: the parity harnesses (block_tint and section_mesh are the direct ones). CI runs them once the stack reaches main.
  • Not measured: in-game chunk loads on the Mac. Its disk is under the 25 GB floor.

🤖 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/6672 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/mesh-tint-uniform` --- ### 📝 Commits (1) - [`9762e4f`](https://github.com/horizon-rust/horizon/commit/9762e4f3dbd801c9f838eac8c9a721c9c04eba9e) Mesher: one-biome sections skip the tint blend ### 📊 Changes **2 files changed** (+164 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/mesher.rs` (+50 -1) ➕ `crates/horizon-client-render/src/mesher/tint_tests.rs` (+114 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of the client performance wave (chunk section meshing). Stacked on #6535. Most sections lie inside one biome. There, each block's blended tint is the mean of `(2r+1)^2` equal colours, which is that colour. `Tints::get` now returns it directly. Before, every block ran the eight-corner biome zoom and summed the whole blend square. ## How it stays exact - **The check.** Once per section, `Tints::uniform_biome` reads every quart cell that any block of the section's blend squares can zoom to. `quart_at_block` picks the block's base cell plus 0 or 1 on each axis, so the check reads the base cells of the section widened by `r`, plus one cell past them. If all of those hold one biome (missing chunks count as plains, as before), every zoomed cell is that biome. - **The colours.** - Grass (plain, or with the dark forest modifier), foliage, dry foliage and water do not depend on position, so the mean is exact. - Swamp grass follows noise, so it keeps the full blend. - **The test.** New `tint_tests::one_biome_shortcut_blends_like_the_full_square` (it needs the prepared resources, like the other mesher geometry tests). It compares the shortcut with the full blend for every block, every resolver, blend radii 0/1/2/5/7, and three heights (column bottom, middle, top). It does this for 7 biomes, each three ways: one biome everywhere, a desert column in the east neighbour, and a missing neighbour. It also checks that the shortcut is taken exactly when the region has one biome. ## A/B (`chunk_load_bench`, seed 1234, radius 8: 4,440 sections per scene, the four `perf_bench` scenes) playhorizon (x86-64 VPS, pinned to 4 vCPUs, load ~20-26). Each figure is the mean of 2 pairs. CPU time per section is the best of 3 rounds. "main" is #6502 rebased on main db34ce484d: the bench only, no mesher change. | Scene | CPU per section with geometry: main → #6535 → this PR | this PR vs #6535 | p99 (µs) | sections/s per core | checksum (all three builds) | |---|---|---|---|---|---| | village | 274.2 → 193.9 → 189.7 µs | −2% | 701 → 518 → 501 | 9,563 → 13,726 → 14,009 | 5f36238a699ae633 | | forest (-69, -35) | 398.8 → 296.7 → 279.2 µs | −6% | 1,335 → 1,017 → 987 | 7,075 → 9,590 → 10,173 | 1c14b8fc4bad6e4c | | ocean (-19, -27) | 447.9 → 310.4 → 238.9 µs | **−23%** | 1,464 → 1,004 → 633 | 7,424 → 10,787 → 13,913 | c5d1ab1a14ba2bd4 | | mountain (35, 54) | 331.0 → 245.6 → 245.0 µs | 0% | 1,399 → 1,090 → 1,016 | 5,876 → 8,036 → 8,045 | 016d55232f7522f4 | - The checksum covers every vertex byte and the visibility graph. It is identical across the three builds in every scene. - Vertex bytes are unchanged. - Ocean gains the most: its sections are water, tinted per vertex, inside one biome. - Mountain gains nothing: its sections cross biome borders (stony peaks, meadows, groves). ## Checks - On playhorizon (`cargo test --release -p horizon-client-render --lib mesher -- --include-ignored`, prepared resources): **65 passed**. That covers the new tint test, the resource-backed reuse and leaf-culling tests, and the sort tests. - Not run by me: the parity harnesses (`block_tint` and `section_mesh` are the direct ones). CI runs them once the stack reaches main. - Not measured: in-game chunk loads on the Mac. Its disk is under the 25 GB floor. 🤖 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 06:32:22 +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#7027
No description provided.