[PR #7358] [MERGED] Render hooks: native_hand_drawn, after the first-person hand is drawn #7546

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

📋 Pull Request Information

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

Base: main ← Head: render/hand-drawn


📝 Commits (4)

  • cf69c65 Render hooks: native_hand_drawn, after the first-person hand is drawn
  • 4471124 The hook gets the hand wherever the game drew it, in the world's pass too
  • f70a3de Merge main into #7358
  • 1b71694 Merge main into #7358

📊 Changes

5 files changed (+105 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+28 -1)
📝 crates/horizon-client-render/src/gfx/native_render.rs (+39 -3)
📝 crates/horizon-client-render/src/gfx/native_render/generated.rs (+16 -0)
📝 docs/native-mods.md (+7 -0)
➕ tools/native-hook-fragments/hand_drawn.json (+15 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally.

Closes #7335.

native_world_drawn runs before the first-person hand. So a mod that works on the picture, like a motion blur, leaves the hand and held item untouched, and never sees the hand's geometry or its matrix (its own field of view and the view bob).

This adds the render hook point native_hand_drawn(hand: &mut HandDrawn) after the hand, on the real frame, wherever native_world_drawn runs (not on the title panorama, not on frame generation's made frame). HandDrawn holds:

  • the device, queue and encoder;
  • the frame's colour target, with the hand in it;
  • the hand's camera-relative quads (Frame::hand), empty when the game drew no hand: third person, F1, or a shader pack's own hand;
  • its clip matrix, hand_projection * bob * view, the product the hand's pass already uploads, now computed once;
  • the camera, the entity atlas and the quad indices.

The generator adds RenderHooks::hand_drawn and its dispatch. The fragment hand_drawn.json numbers it. docs/native-mods.md lists it with the other render hook points.

With no mod it costs one call over an empty list per frame. The hand draws exactly as before: its matrix is the same expression, just bound to a name.

It isn't #7305 (#7276), which poses the hand. This hook only observes, and draws after it.

Proof in the game. I applied a probe bundle with horizon-mixins (pinned ddd9700): one HEAD injection on native_hand_drawn that prints, once a second, the quad count and the hand's on-screen bounds through view_proj. Built --profile fast, ran offscreen with horizon-ctl in scratch homes:

Step What the hook got
Creative world, empty hand 12 quads (the arm), NDC x 0.39–1.24, y −2.84 to −0.37, depth 0.04–0.12: bottom right
/give @s diamond_sword 82 quads, x up to 2.65, y up to 0.21–0.39 as the equip animation ends, matching the sword in the screenshot
F5, third person 0 quads, still called every frame

The first run got 0 quads in first person. A build without the launcher's build info draws the hand at the end of the world's pass (hand_in_world), not in its own pass. The second commit passes the hand wherever the game drew it, so the hook sees it either way.

Checks (cargo +stable):

  • fmt --all -- --check: ok
  • xtask mod-api --check: ok
  • clippy -p horizon-client-render --lib --tests and -p horizon-client --lib --bins --tests, with -D warnings: ok
  • test -p horizon-client-render --lib: 1159 passed
  • catalog_matches_hook_points: ok
  • tests.test_stamp_native_hooks: ok

🤖 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/7358 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `render/hand-drawn` --- ### 📝 Commits (4) - [`cf69c65`](https://github.com/horizon-rust/horizon/commit/cf69c65c8340e8a1d8ce391a7f8fc1d467185165) Render hooks: native_hand_drawn, after the first-person hand is drawn - [`4471124`](https://github.com/horizon-rust/horizon/commit/44711243f8ee88410dde547bf9424f1f95d03412) The hook gets the hand wherever the game drew it, in the world's pass too - [`f70a3de`](https://github.com/horizon-rust/horizon/commit/f70a3de53f4a0eec95e9dafe9e2dfad5a6760919) Merge main into #7358 - [`1b71694`](https://github.com/horizon-rust/horizon/commit/1b71694071f9b56cb6bb8d9c2525c42eb5eb0bf0) Merge main into #7358 ### 📊 Changes **5 files changed** (+105 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+28 -1) 📝 `crates/horizon-client-render/src/gfx/native_render.rs` (+39 -3) 📝 `crates/horizon-client-render/src/gfx/native_render/generated.rs` (+16 -0) 📝 `docs/native-mods.md` (+7 -0) ➕ `tools/native-hook-fragments/hand_drawn.json` (+15 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally. Closes #7335. `native_world_drawn` runs before the first-person hand. So a mod that works on the picture, like a motion blur, leaves the hand and held item untouched, and never sees the hand's geometry or its matrix (its own field of view and the view bob). This adds the render hook point `native_hand_drawn(hand: &mut HandDrawn)` after the hand, on the real frame, wherever `native_world_drawn` runs (not on the title panorama, not on frame generation's made frame). `HandDrawn` holds: - the device, queue and encoder; - the frame's colour target, with the hand in it; - the hand's camera-relative quads (`Frame::hand`), empty when the game drew no hand: third person, F1, or a shader pack's own hand; - its clip matrix, `hand_projection * bob * view`, the product the hand's pass already uploads, now computed once; - the camera, the entity atlas and the quad indices. The generator adds `RenderHooks::hand_drawn` and its dispatch. The fragment `hand_drawn.json` numbers it. `docs/native-mods.md` lists it with the other render hook points. With no mod it costs one call over an empty list per frame. The hand draws exactly as before: its matrix is the same expression, just bound to a name. It isn't #7305 (#7276), which poses the hand. This hook only observes, and draws after it. **Proof in the game.** I applied a probe bundle with horizon-mixins (pinned `ddd9700`): one HEAD injection on `native_hand_drawn` that prints, once a second, the quad count and the hand's on-screen bounds through `view_proj`. Built `--profile fast`, ran offscreen with `horizon-ctl` in scratch homes: | Step | What the hook got | | --- | --- | | Creative world, empty hand | 12 quads (the arm), NDC x 0.39–1.24, y −2.84 to −0.37, depth 0.04–0.12: bottom right | | `/give @s diamond_sword` | 82 quads, x up to 2.65, y up to 0.21–0.39 as the equip animation ends, matching the sword in the screenshot | | F5, third person | 0 quads, still called every frame | The first run got 0 quads in first person. A build without the launcher's build info draws the hand at the end of the world's pass (`hand_in_world`), not in its own pass. The second commit passes the hand wherever the game drew it, so the hook sees it either way. **Checks** (`cargo +stable`): - `fmt --all -- --check`: ok - `xtask mod-api --check`: ok - `clippy -p horizon-client-render --lib --tests` and `-p horizon-client --lib --bins --tests`, with `-D warnings`: ok - `test -p horizon-client-render --lib`: 1159 passed - `catalog_matches_hook_points`: ok - `tests.test_stamp_native_hooks`: ok 🤖 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 07:19:27 +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#7546
No description provided.