[PR #1801] [MERGED] Shader packs, clean room 36: the hand #3770

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1801
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: feat/shader-packs-hand


📝 Commits (10+)

  • b5a7911 Shader packs, clean room 30: the loader's alpha test
  • ab289a2 Shader packs, clean room 31: entities and block entities
  • 3a7d00a Shader packs, clean room 32: translucent entity parts and particles
  • abe7047 Shader packs, clean room 33: clouds
  • 173463a Shader packs, clean room 34: rain and snow
  • 18cac82 Shader packs, clean room 35: held item ids and light
  • 224b83c Shader packs, clean room 36: the hand
  • 90fe138 Merge branch 'feat/shader-packs-entity-spans' into feat/shader-packs-alpha-test
  • c4856e6 Merge branch 'feat/shader-packs-alpha-test' into feat/shader-packs-entities
  • 257654e Merge branch 'feat/shader-packs-entities' into feat/shader-packs-translucent-entities

📊 Changes

18 files changed (+1841 additions, -29 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -3)
📝 crates/horizon-client/src/game/names.rs (+4 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+63 -0)
📝 crates/horizon-client/src/gfx.rs (+87 -10)
📝 crates/horizon-client/src/gfx/pack_atlas.rs (+1 -0)
📝 crates/horizon-client/src/gfx/pack_draw.rs (+2 -0)
➕ crates/horizon-client/src/gfx/pack_entities.rs (+462 -0)
➕ crates/horizon-client/src/gfx/pack_hand.rs (+169 -0)
📝 crates/horizon-client/src/gfx/pack_post.rs (+405 -5)
📝 crates/horizon-client/src/gfx/pack_sky.rs (+2 -0)
📝 crates/horizon-client/src/gfx/pack_timing.rs (+2 -1)
📝 crates/horizon-client/src/gfx/pack_uniforms.rs (+8 -2)
➕ crates/horizon-client/src/gfx/pack_weather.rs (+264 -0)
📝 crates/horizon-shaders/src/lib.rs (+1 -1)
📝 crates/horizon-shaders/src/post.rs (+228 -4)
📝 crates/horizon-shaders/src/translate/mod.rs (+125 -1)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+7 -0)
📝 crates/horizon-shaders/tests/real_packs.rs (+8 -2)

📄 Description

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

Shader packs, clean room 36: a pack draws the first-person hand. Stacked on #1800. This closes the third group of slice 7 (#1800–#1801); the group's checks are below.

What

  • gbuffers_hand (→ textured_lit → textured → basic, spec 2.3) draws the hand and held items.
    • They draw after the opaque world and the clouds, before deferred, into the pack's buffers and the world's depth.
    • No blending, and the entities' 0.1 alpha cut (OQ-23).
  • Vertices: Horizon's own hand geometry, read as entities are (normals, at_tangent and mc_midTexCoord from the quad).
  • Matrices (5.2):
    • gl_ProjectionMatrix is the hand's own projection: the hand's field of view and the view bob, with clip depth scaled by MC_HAND_DEPTH (0.125, 1.5), so the hand sits in front of the world in the shared depth buffer.
    • gbufferProjection stays the world's.
  • Without a shader pack nothing changes: Horizon's hand draw is skipped only when the pack draws the hand.
  • Not in this PR:
    • gbuffers_hand_water: translucent held items draw with gbuffers_hand.
    • Lines and the glint: they wait for the spec team's answers (questions 6 and 7 in cleanroom/questions/).
      • Vanilla 26.3 widens lines in its own vertex shader. Its glint is no longer a separate draw.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §1.5, §2.3, §5.2, §5.4, OQ-23; no other loader's code read.

How tested

  • Unit tests:
    • hand_depth_is_scaled_around_the_middle: window depth within MC_HAND_DEPTH of 0.5, same x and y as the plain projection;
    • the hand chain in water_falls_back_to_terrain_and_blends.
  • In game (screenshots local; the packs' licences forbid uploading them): BSL and Complementary draw a sword and a torch in place, lit by the pack.

Group checks (#1800–#1801)

  • A/B without a pack (village, RD 16, 720p, Mac mini, 5 alternating paired runs, #1786 against this branch, on a busy machine):

    #1786 this branch
    CPU p50 (median) 0.455 ms 0.476 ms
    GPU p50 (median) 0.781 ms 0.783 ms

    Both are within the spread of the runs (CPU 0.31–0.51 ms). Horizon's hand draw is still one call.

  • Screenshots without a pack (#1786 against this branch): a sword and a torch in hand, and the day view, are the same. Only water animation differs.

  • Parity: the 27 harnesses that game/shader_packs.rs selects pass. The gfx files select about 108; CI runs them.

  • Overhead with a pack (HORIZON_SHADER_PACK_TIMING, village, RD 16, 720p):

    • BSL: world copy 0.045 ms; its hand program costs 0.023 ms.
    • Complementary: its hand program costs 0.031 ms. Its world copy reads high as explained in #1786: Horizon's clouds are skipped, and frame GPU p50 is unchanged.

Self-check (whole stack, on this branch)

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 4a675206b, 10 min 58 s)

Check Result
Scope ⚠️ 57 files, +11042 −52; 10688 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (58 s)
tests: workspace ✅ 2023 passed (9 min 8 s)
doc tests ✅ 1 passed (45 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: 326 harnesses selected, because the root Cargo.toml and gfx.rs change earlier in the stack; CI runs them. Locally, the 27 harnesses this group's game file selects pass. These PRs act only with HORIZON_SHADER_PACK. The Label row is the tool's generic hint: these PRs are skip-release.

Needs Ludovic

Nothing. Label skip-release: players see no change.

🤖 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/1801 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-hand` --- ### 📝 Commits (10+) - [`b5a7911`](https://github.com/horizon-rust/horizon/commit/b5a791170d1e1bec47f2508419d2918c72f891f1) Shader packs, clean room 30: the loader's alpha test - [`ab289a2`](https://github.com/horizon-rust/horizon/commit/ab289a2cf3f84fac470eb146e140c2fa7dc55f67) Shader packs, clean room 31: entities and block entities - [`3a7d00a`](https://github.com/horizon-rust/horizon/commit/3a7d00a74c3202242356b31ef94a53e8b4478fba) Shader packs, clean room 32: translucent entity parts and particles - [`abe7047`](https://github.com/horizon-rust/horizon/commit/abe7047d1947e12225a8baa120b8f4b86ace0a70) Shader packs, clean room 33: clouds - [`173463a`](https://github.com/horizon-rust/horizon/commit/173463acdf4fa73f15089567bf2152a235ed328e) Shader packs, clean room 34: rain and snow - [`18cac82`](https://github.com/horizon-rust/horizon/commit/18cac82d448888c5901b9b29679fd3a5dfae6230) Shader packs, clean room 35: held item ids and light - [`224b83c`](https://github.com/horizon-rust/horizon/commit/224b83c6a6ab13fb3d5876630c93f9346c3db22f) Shader packs, clean room 36: the hand - [`90fe138`](https://github.com/horizon-rust/horizon/commit/90fe138e836881088c771c8d8106e090b836c1ba) Merge branch 'feat/shader-packs-entity-spans' into feat/shader-packs-alpha-test - [`c4856e6`](https://github.com/horizon-rust/horizon/commit/c4856e6febb28aeb6faa06c4c2ea6e5cf8c73c8a) Merge branch 'feat/shader-packs-alpha-test' into feat/shader-packs-entities - [`257654e`](https://github.com/horizon-rust/horizon/commit/257654ef30b6ead67be08b5128428ff057a54229) Merge branch 'feat/shader-packs-entities' into feat/shader-packs-translucent-entities ### 📊 Changes **18 files changed** (+1841 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -3) 📝 `crates/horizon-client/src/game/names.rs` (+4 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+63 -0) 📝 `crates/horizon-client/src/gfx.rs` (+87 -10) 📝 `crates/horizon-client/src/gfx/pack_atlas.rs` (+1 -0) 📝 `crates/horizon-client/src/gfx/pack_draw.rs` (+2 -0) ➕ `crates/horizon-client/src/gfx/pack_entities.rs` (+462 -0) ➕ `crates/horizon-client/src/gfx/pack_hand.rs` (+169 -0) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+405 -5) 📝 `crates/horizon-client/src/gfx/pack_sky.rs` (+2 -0) 📝 `crates/horizon-client/src/gfx/pack_timing.rs` (+2 -1) 📝 `crates/horizon-client/src/gfx/pack_uniforms.rs` (+8 -2) ➕ `crates/horizon-client/src/gfx/pack_weather.rs` (+264 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+1 -1) 📝 `crates/horizon-shaders/src/post.rs` (+228 -4) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+125 -1) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+7 -0) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+8 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 36:** a pack draws the first-person hand. Stacked on #1800. This closes the third group of slice 7 (#1800–#1801); the group's checks are below. ## What - **`gbuffers_hand`** (→ `textured_lit` → `textured` → `basic`, spec 2.3) draws the hand and held items. - They draw after the opaque world and the clouds, before deferred, into the pack's buffers and the world's depth. - No blending, and the entities' 0.1 alpha cut (OQ-23). - **Vertices:** Horizon's own hand geometry, read as entities are (normals, `at_tangent` and `mc_midTexCoord` from the quad). - **Matrices** (5.2): - `gl_ProjectionMatrix` is the hand's own projection: the hand's field of view and the view bob, with clip depth scaled by `MC_HAND_DEPTH` (0.125, 1.5), so the hand sits in front of the world in the shared depth buffer. - `gbufferProjection` stays the world's. - **Without a shader pack** nothing changes: Horizon's hand draw is skipped only when the pack draws the hand. - **Not in this PR:** - `gbuffers_hand_water`: translucent held items draw with `gbuffers_hand`. - Lines and the glint: they wait for the spec team's answers (questions 6 and 7 in `cleanroom/questions/`). - Vanilla 26.3 widens lines in its own vertex shader. Its glint is no longer a separate draw. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §1.5, §2.3, §5.2, §5.4, OQ-23; no other loader's code read. ## How tested - **Unit tests:** - `hand_depth_is_scaled_around_the_middle`: window depth within `MC_HAND_DEPTH` of 0.5, same x and y as the plain projection; - the hand chain in `water_falls_back_to_terrain_and_blends`. - **In game** (screenshots local; the packs' licences forbid uploading them): BSL and Complementary draw a sword and a torch in place, lit by the pack. ## Group checks (#1800–#1801) - **A/B without a pack** (village, RD 16, 720p, Mac mini, 5 alternating paired runs, #1786 against this branch, on a busy machine): | | #1786 | this branch | |---|---|---| | CPU p50 (median) | 0.455 ms | 0.476 ms | | GPU p50 (median) | 0.781 ms | 0.783 ms | Both are within the spread of the runs (CPU 0.31–0.51 ms). Horizon's hand draw is still one call. - **Screenshots without a pack** (#1786 against this branch): a sword and a torch in hand, and the day view, are the same. Only water animation differs. - **Parity:** the 27 harnesses that `game/shader_packs.rs` selects pass. The `gfx` files select about 108; CI runs them. - **Overhead with a pack** (`HORIZON_SHADER_PACK_TIMING`, village, RD 16, 720p): - **BSL:** world copy 0.045 ms; its hand program costs 0.023 ms. - **Complementary:** its hand program costs 0.031 ms. Its world copy reads high as explained in #1786: Horizon's clouds are skipped, and frame GPU p50 is unchanged. ## Self-check (whole stack, on this branch) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 4a675206b, 10 min 58 s) | Check | Result | | --- | --- | | Scope | ⚠️ 57 files, +11042 −52; 10688 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (58 s) | | tests: workspace | ✅ 2023 passed (9 min 8 s) | | doc tests | ✅ 1 passed (45 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: 326 harnesses selected, because the root `Cargo.toml` and `gfx.rs` change earlier in the stack; CI runs them. Locally, the 27 harnesses this group's game file selects pass. These PRs act only with `HORIZON_SHADER_PACK`. The Label row is the tool's generic hint: these PRs are `skip-release`. ## Needs Ludovic Nothing. Label `skip-release`: players see no change. 🤖 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 04:12:12 +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#3770
No description provided.