[PR #5519] [MERGED] Render fancy leaves front-to-back #6332

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5519
Author: @elythepreciouscat
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: perf/leaf-cutout


📝 Commits (3)

  • 095b522 Optimize alpha-tested leaf rendering order
  • 31456cb Move leaf draw ordering into mesh workers
  • 8f78587 Remove redundant render upload diff

📊 Changes

3 files changed (+70 additions, -5 deletions)

View changed files

📝 crates/horizon-client-render/src/mesher/sides.rs (+70 -5)
➕ docs/media/leaf-cutout-after.png (+0 -0)
➕ docs/media/leaf-cutout-before.png (+0 -0)

📄 Description

🤖 Opened by elythepreciouscat's AI agent (Codex, GPT-6), not by elythepreciouscat personally.

What and why

Fixes #5322.

Fancy/see-through leaves currently submit many alpha-tested fragments that are hidden by nearer terrain in the same section. This change keeps the canonical section mesh, vertex attributes, UVs, and terrain shader unchanged, but uploads solid cutout sections in a depth-friendly order. Positive and negative axis-facing buckets are ordered from the outside toward the section interior; coplanar faces keep their original order.

The renderer continues to use the shared quad index buffer and existing section arena. There are no per-section custom index pages, no new draw-page fragmentation, and no geometry merging. Opaque-only sections and sections without solid cutout faces use the original upload path unchanged. Translucent terrain remains in its existing separate pass.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

The implementation preserves the Java Edition 26.3 section-mesh contract: SectionCompiler and ModelBlockRenderer keep cutout leaves in the solid terrain layer, with forceOpaque controlling the alpha-test exception. The optimization only changes upload order after the canonical mesh has been produced. python3 tools/parity.py section_mesh passed with client and Rust quad counts both at 1,008,927.

Other projects' code

None.

Self-check

Renderer-specific checks passed:

  • cargo test --locked -p horizon-client-render --lib: 814 passed, 22 ignored after rebasing onto current main
  • cargo clippy --locked -p horizon-client-render --lib -- -D warnings: passed
  • cargo fmt --all -- --check: passed
  • python3 tools/check_public_tree.py: passed
  • python3 tools/parity.py section_mesh: passed in 164 seconds after rebasing

The earlier python3 tools/pr_ready.py --quick run reported renderer tests, clippy, rustfmt, doc tests, and public-tree checks as passing. Its repository-wide Python suite had one unrelated existing fixture error in test_perf_bench.py::test_table_distinguishes_missing_scene_load_from_zero, and the known-flaky dedicated_server harness failed one of its retry runs. The command therefore exited non-zero despite the touched-crate checks passing.

Benchmark: same fresh sandbox, LeafCloud, seed 987654321, render distance 8, 675×727 Vulkan on Intel HD Graphics 4000, with the same stabilized control script.

Mode Baseline FPS Branch FPS Baseline render Branch render
Fancy 84.18 95.43 2.018 ms 1.688 ms
Fancy after fast toggle 60.89 69.09 1.548 ms 1.362 ms

This is approximately 13% higher FPS and 12–16% lower render time in the leaf-heavy scene. Section draw calls stayed at 3 and section vertex memory stayed effectively unchanged.

Screenshots

Both captures are 675×727 renders of the same LeafCloud scene with the same seed, clear weather, and fancy leaves enabled. The baseline is the unmodified client; the after image is this branch. The foliage density, texture detail, and see-through appearance are retained.

Before

Leaf rendering before the optimization

After

Leaf rendering after the optimization

The captures were taken in separate fresh runs, so normal chunk/tick timing can change animated sky and loading details; they are visual evidence of preserved foliage quality, not a pixel-by-pixel parity fixture.

🤖 Generated with Codex


🔄 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/5519 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/leaf-cutout` --- ### 📝 Commits (3) - [`095b522`](https://github.com/horizon-rust/horizon/commit/095b522455bbfae7c3f8f6c3081a34a33b917a74) Optimize alpha-tested leaf rendering order - [`31456cb`](https://github.com/horizon-rust/horizon/commit/31456cb738ebb92128fbe692ffc2e7a2d6ad83c2) Move leaf draw ordering into mesh workers - [`8f78587`](https://github.com/horizon-rust/horizon/commit/8f785872f85398c7c8109143f516e86d05831595) Remove redundant render upload diff ### 📊 Changes **3 files changed** (+70 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/mesher/sides.rs` (+70 -5) ➕ `docs/media/leaf-cutout-after.png` (+0 -0) ➕ `docs/media/leaf-cutout-before.png` (+0 -0) </details> ### 📄 Description > 🤖 Opened by elythepreciouscat's AI agent (Codex, GPT-6), not by elythepreciouscat personally. ## What and why Fixes #5322. Fancy/see-through leaves currently submit many alpha-tested fragments that are hidden by nearer terrain in the same section. This change keeps the canonical section mesh, vertex attributes, UVs, and terrain shader unchanged, but uploads solid cutout sections in a depth-friendly order. Positive and negative axis-facing buckets are ordered from the outside toward the section interior; coplanar faces keep their original order. The renderer continues to use the shared quad index buffer and existing section arena. There are no per-section custom index pages, no new draw-page fragmentation, and no geometry merging. Opaque-only sections and sections without solid cutout faces use the original upload path unchanged. Translucent terrain remains in its existing separate pass. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [x] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference The implementation preserves the Java Edition 26.3 section-mesh contract: `SectionCompiler` and `ModelBlockRenderer` keep cutout leaves in the solid terrain layer, with `forceOpaque` controlling the alpha-test exception. The optimization only changes upload order after the canonical mesh has been produced. `python3 tools/parity.py section_mesh` passed with client and Rust quad counts both at `1,008,927`. ## Other projects' code None. ## Self-check Renderer-specific checks passed: - `cargo test --locked -p horizon-client-render --lib`: 814 passed, 22 ignored after rebasing onto current `main` - `cargo clippy --locked -p horizon-client-render --lib -- -D warnings`: passed - `cargo fmt --all -- --check`: passed - `python3 tools/check_public_tree.py`: passed - `python3 tools/parity.py section_mesh`: passed in 164 seconds after rebasing The earlier `python3 tools/pr_ready.py --quick` run reported renderer tests, clippy, rustfmt, doc tests, and public-tree checks as passing. Its repository-wide Python suite had one unrelated existing fixture error in `test_perf_bench.py::test_table_distinguishes_missing_scene_load_from_zero`, and the known-flaky `dedicated_server` harness failed one of its retry runs. The command therefore exited non-zero despite the touched-crate checks passing. Benchmark: same fresh sandbox, `LeafCloud`, seed `987654321`, render distance 8, 675×727 Vulkan on Intel HD Graphics 4000, with the same stabilized control script. | Mode | Baseline FPS | Branch FPS | Baseline render | Branch render | | --- | ---: | ---: | ---: | ---: | | Fancy | 84.18 | 95.43 | 2.018 ms | 1.688 ms | | Fancy after fast toggle | 60.89 | 69.09 | 1.548 ms | 1.362 ms | This is approximately 13% higher FPS and 12–16% lower render time in the leaf-heavy scene. Section draw calls stayed at 3 and section vertex memory stayed effectively unchanged. ## Screenshots Both captures are 675×727 renders of the same `LeafCloud` scene with the same seed, clear weather, and fancy leaves enabled. The baseline is the unmodified client; the after image is this branch. The foliage density, texture detail, and see-through appearance are retained. **Before** ![Leaf rendering before the optimization](https://raw.githubusercontent.com/elythepreciouscat/horizon/609e1ec4b81ca3799ba81d6fc2f6dcdb01c5a332/docs/media/leaf-cutout-before.png) **After** ![Leaf rendering after the optimization](https://raw.githubusercontent.com/elythepreciouscat/horizon/609e1ec4b81ca3799ba81d6fc2f6dcdb01c5a332/docs/media/leaf-cutout-after.png) The captures were taken in separate fresh runs, so normal chunk/tick timing can change animated sky and loading details; they are visual evidence of preserved foliage quality, not a pixel-by-pixel parity fixture. <!-- Please tick "Allow edits by maintainers". --> 🤖 Generated with [Codex](https://openai.com/codex) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:18:24 +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#6332
No description provided.