[PR #609] [MERGED] fix(rendering): correct selection outline on translucent blocks #2674

Closed
opened 2026-11-02 15:58:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/609
Author: @LookImEcho-Rick
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/563-translucent-block-outline


📝 Commits (1)

  • 5d614f1 fix(rendering): correct selection outline on translucent blocks

📊 Changes

10 files changed (+422 additions, -23 deletions)

View changed files

➕ crates/horizon-client/examples/translucency_fixture.rs (+47 -0)
📝 crates/horizon-client/src/game.rs (+13 -1)
📝 crates/horizon-client/src/gfx.rs (+87 -14)
📝 crates/horizon-client/src/gfx/arena.rs (+24 -8)
📝 crates/horizon-client/src/gfx/resident.rs (+3 -0)
➕ crates/horizon-client/src/gfx/translucency.rs (+119 -0)
➕ docs/media/issue563-outline-after.png (+0 -0)
➕ docs/media/issue563-outline-before.png (+0 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTranslucencyOracle.java (+63 -0)
➕ tools/test_translucency_parity.py (+66 -0)

📄 Description

What and why

Fixes #563.

Horizon drew selection outlines before translucent terrain, which then blended over them. Its translucent pass also lacked per-quad sorting and depth writes. Sort translucent quads farthest-first using cached section-relative indices, enable the classic vanilla depth-write settings, and route translucent targets' outlines after terrain. Opaque targets retain their earlier draw position; outline color, opacity and width are unchanged. Indirect multi-draw is retained and no render pass is added.

Vanilla reference

Inspected Minecraft Java Edition 26.3 directly through mcsrc.dev before implementation:

  • LevelExtractor.extractBlockOutline, LevelRenderer.submitBlockOutline / submitHitOutline / executeClassicTransparency, SubmitNodeCollection.submitShapeOutline and FeatureRenderDispatcher.PreparedFrame: model translucency selects outline placement before or after translucent terrain.
  • RenderTypes line definitions, RenderPipelines line/terrain definitions, DepthStencilState.DEFAULT and BlendFunction.TRANSLUCENT: classic reversed-depth GreaterEqual testing, depth writes and source-alpha blending; normal outline black has alpha 102/255.
  • VertexSorting.byDistance, MeshData.decodeQuadCentroids / SortState.writeIndices, SectionRenderDispatcher.createVertexSorting / ResortTransparencyTask.doTask, TranslucencyPointOfView, and LevelRenderer's resort scheduling: stable descending squared-distance ordering, opposite-corner centers, unchanged triangle winding and cached index updates.

The new tools/test_translucency_parity.py calls the pinned game's centroid/sort/index routines through VanillaTranslucencyOracle and compares them with the production Rust implementation.

Self-check

Rebased onto upstream main at e422bd13. Hooks configured with git config core.hooksPath .githooks; commit and push public-tree hooks passed.

python3 tools/pr_ready.py could not run through the Windows Python alias. Retrying with installed Python fails during import at tools/parity.py:64: AttributeError: module 'os' has no attribute 'uname'. It therefore produced no self-check result block. The complete pr_ready gate is not claimed as passed.

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings Passed on current rebased branch
python tools/test_translucency_parity.py --profile dev Passed: 205 cases / 4,084 camera views; exact centers, indices and cache decisions
Renderer tests 41 passed, 2 ignored
cargo test --quiet --locked -p horizon-client --lib 763 passed, 3 failed, 9 ignored
Changed Rust files: rustfmt check; git diff --check Passed
cargo fmt --all -- --check Blocked by Windows command-line length, OS error 206
python tools/check_public_tree.py --history Passed
Client and horizon-ctl build Passed

The three library failures are crash::tests::stacks_start_at_the_panicking_frame (Windows path normalization), packs::cache::tests::directory_inputs_config_and_owned_output_recovery (access denied), and save::tests::session_lock_is_exclusive (file locking). These files are unchanged.

Visual checks on Vulkan covered ice, red stained glass, slime, honey, stone, adjacent ice, camera reversal, and a targeted ice block partially obscured by stone. The user tested the result and approved PR creation. A further section-boundary scene had missing geometry also reproduced on unmodified main; that separate issue is not included. Pixel-exact vanilla comparison, the improved-transparency/OIT path, and performance benchmarking are not established by these checks.

Screenshots

Horizon before and after, using the same camera position and direction in separate sessions. These are Horizon captures, not a pixel comparison with vanilla.

Before After
Faint ice selection outline Visible ice selection outline

🔄 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/609 **Author:** [@LookImEcho-Rick](https://github.com/LookImEcho-Rick) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/563-translucent-block-outline` --- ### 📝 Commits (1) - [`5d614f1`](https://github.com/horizon-rust/horizon/commit/5d614f1cf6b4ffaad6dad90505a0928b638da6ed) fix(rendering): correct selection outline on translucent blocks ### 📊 Changes **10 files changed** (+422 additions, -23 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/translucency_fixture.rs` (+47 -0) 📝 `crates/horizon-client/src/game.rs` (+13 -1) 📝 `crates/horizon-client/src/gfx.rs` (+87 -14) 📝 `crates/horizon-client/src/gfx/arena.rs` (+24 -8) 📝 `crates/horizon-client/src/gfx/resident.rs` (+3 -0) ➕ `crates/horizon-client/src/gfx/translucency.rs` (+119 -0) ➕ `docs/media/issue563-outline-after.png` (+0 -0) ➕ `docs/media/issue563-outline-before.png` (+0 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTranslucencyOracle.java` (+63 -0) ➕ `tools/test_translucency_parity.py` (+66 -0) </details> ### 📄 Description ## What and why Fixes #563. Horizon drew selection outlines before translucent terrain, which then blended over them. Its translucent pass also lacked per-quad sorting and depth writes. Sort translucent quads farthest-first using cached section-relative indices, enable the classic vanilla depth-write settings, and route translucent targets' outlines after terrain. Opaque targets retain their earlier draw position; outline color, opacity and width are unchanged. Indirect multi-draw is retained and no render pass is added. ## Vanilla reference Inspected Minecraft Java Edition **26.3** directly through mcsrc.dev before implementation: - [LevelExtractor.extractBlockOutline](https://mcsrc.dev/2/26.3/net/minecraft/client/renderer/extract/LevelExtractor), LevelRenderer.submitBlockOutline / submitHitOutline / executeClassicTransparency, SubmitNodeCollection.submitShapeOutline and FeatureRenderDispatcher.PreparedFrame: model translucency selects outline placement before or after translucent terrain. - RenderTypes line definitions, RenderPipelines line/terrain definitions, DepthStencilState.DEFAULT and BlendFunction.TRANSLUCENT: classic reversed-depth GreaterEqual testing, depth writes and source-alpha blending; normal outline black has alpha 102/255. - [VertexSorting.byDistance](https://mcsrc.dev/2/26.3/com/mojang/blaze3d/vertex/VertexSorting), MeshData.decodeQuadCentroids / SortState.writeIndices, SectionRenderDispatcher.createVertexSorting / ResortTransparencyTask.doTask, TranslucencyPointOfView, and LevelRenderer's resort scheduling: stable descending squared-distance ordering, opposite-corner centers, unchanged triangle winding and cached index updates. The new `tools/test_translucency_parity.py` calls the pinned game's centroid/sort/index routines through VanillaTranslucencyOracle and compares them with the production Rust implementation. ## Self-check Rebased onto upstream `main` at `e422bd13`. Hooks configured with `git config core.hooksPath .githooks`; commit and push public-tree hooks passed. `python3 tools/pr_ready.py` could not run through the Windows Python alias. Retrying with installed Python fails during import at `tools/parity.py:64`: `AttributeError: module 'os' has no attribute 'uname'`. It therefore produced no self-check result block. The complete pr_ready gate is **not claimed as passed**. | Check | Result | | --- | --- | | `cargo clippy --workspace --all-targets --locked -- -D warnings` | Passed on current rebased branch | | `python tools/test_translucency_parity.py --profile dev` | Passed: 205 cases / 4,084 camera views; exact centers, indices and cache decisions | | Renderer tests | 41 passed, 2 ignored | | `cargo test --quiet --locked -p horizon-client --lib` | 763 passed, 3 failed, 9 ignored | | Changed Rust files: rustfmt check; `git diff --check` | Passed | | `cargo fmt --all -- --check` | Blocked by Windows command-line length, OS error 206 | | `python tools/check_public_tree.py --history` | Passed | | Client and horizon-ctl build | Passed | The three library failures are `crash::tests::stacks_start_at_the_panicking_frame` (Windows path normalization), `packs::cache::tests::directory_inputs_config_and_owned_output_recovery` (access denied), and `save::tests::session_lock_is_exclusive` (file locking). These files are unchanged. Visual checks on Vulkan covered ice, red stained glass, slime, honey, stone, adjacent ice, camera reversal, and a targeted ice block partially obscured by stone. The user tested the result and approved PR creation. A further section-boundary scene had missing geometry also reproduced on unmodified main; that separate issue is not included. Pixel-exact vanilla comparison, the improved-transparency/OIT path, and performance benchmarking are not established by these checks. ## Screenshots Horizon before and after, using the same camera position and direction in separate sessions. These are Horizon captures, not a pixel comparison with vanilla. | Before | After | | --- | --- | | ![Faint ice selection outline](https://raw.githubusercontent.com/LookImEcho-Rick/horizon/5d614f1cf6b4ffaad6dad90505a0928b638da6ed/docs/media/issue563-outline-before.png) | ![Visible ice selection outline](https://raw.githubusercontent.com/LookImEcho-Rick/horizon/5d614f1cf6b4ffaad6dad90505a0928b638da6ed/docs/media/issue563-outline-after.png) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58: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#2674
No description provided.