[PR #476] [MERGED] F3 debug crosshair: no view bob, drawn after the hand like vanilla #2592

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

📋 Pull Request Information

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

Base: main ← Head: fix/debug-crosshair-no-bob


📝 Commits (1)

  • 23a54d4 F3 debug crosshair: drawn at the hand's projection, without the view bob

📊 Changes

2 files changed (+93 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -4)
📝 crates/horizon-client/src/gfx.rs (+88 -2)

📄 Description

Fixes #475

What: the F3 debug crosshair (world axes) no longer bobs with View Bobbing. A regression from #416.

Vanilla 26.3: GameRenderer.render3dHud draws DebugCrosshairRenderer.render after the hand (renderItemInHand) and the screen effects. It uses the hudProjection (setupPerspective(0.05, depthFar, hudFov, …)), and the bob (bobHurt/bobView) is only multiplied into the level projection in renderLevel, so the axes don't get it. Fog is FogMode.NONE. Horizon drew the axes among the world's always-on-top gizmos, with the world projection, which includes frame.bob (gfx.rs view_projection). That's what @asprintf suspected.

How: Frame.debug_crosshair carries the axes apart from the other gizmos. gfx.rs writes a crosshair_globals uniform (hand_projection * view, no bob, fog colour alpha 0) and draws the lines in a "3d crosshair" pass after the hand and screen-effect passes. gizmos::debug_crosshair (the geometry) is unchanged.

Verified in game (Mac mini, offscreen, horizon-ctl): F3 on, View Bobbing on (default), walking west on flat stone. I took a screenshot standing, then four while walking ~110 ms apart, and measured the pixel bounding boxes of the red/green/blue axes:

frame origin/main: green axis box this PR: green axis box held block top edge (bob phase)
standing (639,345)-(640,359) (639,345)-(640,359) 560 / 560
walk 1 (613,354)-(615,367) (639,345)-(640,359) 579 / 617
walk 2 (654,385)-(655,398) (639,345)-(640,359) 601 / 607
walk 3 (649,389)-(650,402) (639,345)-(640,359) 608 / 558
walk 4 (619,375)-(620,388) (639,345)-(640,359) 604 / 614

On main the axes move by up to 40 px. With this PR they stay on the same pixels while the hand bobs between y=558 and 617. Standing, both builds draw the same pixels (default FOV 70 = hudFov).

Self-check: cargo fmt --check ok; cargo clippy -p horizon-client --all-targets -- -D warnings ok; cargo test -p horizon-client --lib -- gfx gizmos 35 passed. Workspace clippy, the full client tests and tools/parity.py --changed origin/main run on the combined branch of this batch (results in the thread report).

Note: vanilla depth-tests the axes against the hand (LINES / LINES_DEPTH_BIAS); Horizon keeps drawing them on top, as #416 did. That only differs when the hand covers the screen centre.

🤖 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/476 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/debug-crosshair-no-bob` --- ### 📝 Commits (1) - [`23a54d4`](https://github.com/horizon-rust/horizon/commit/23a54d4a22ca870dfc162a8a49d1f3bebd493eae) F3 debug crosshair: drawn at the hand's projection, without the view bob ### 📊 Changes **2 files changed** (+93 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -4) 📝 `crates/horizon-client/src/gfx.rs` (+88 -2) </details> ### 📄 Description Fixes #475 **What:** the F3 debug crosshair (world axes) no longer bobs with View Bobbing. A regression from #416. **Vanilla 26.3:** `GameRenderer.render3dHud` draws `DebugCrosshairRenderer.render` after the hand (`renderItemInHand`) and the screen effects. It uses the `hudProjection` (`setupPerspective(0.05, depthFar, hudFov, …)`), and the bob (`bobHurt`/`bobView`) is only multiplied into the level projection in `renderLevel`, so the axes don't get it. Fog is `FogMode.NONE`. Horizon drew the axes among the world's always-on-top gizmos, with the world projection, which includes `frame.bob` (`gfx.rs` `view_projection`). That's what @asprintf suspected. **How:** `Frame.debug_crosshair` carries the axes apart from the other gizmos. `gfx.rs` writes a `crosshair_globals` uniform (`hand_projection * view`, no bob, fog colour alpha 0) and draws the lines in a "3d crosshair" pass after the hand and screen-effect passes. `gizmos::debug_crosshair` (the geometry) is unchanged. **Verified in game** (Mac mini, offscreen, `horizon-ctl`): F3 on, View Bobbing on (default), walking west on flat stone. I took a screenshot standing, then four while walking ~110 ms apart, and measured the pixel bounding boxes of the red/green/blue axes: | frame | origin/main: green axis box | this PR: green axis box | held block top edge (bob phase) | |---|---|---|---| | standing | (639,345)-(640,359) | (639,345)-(640,359) | 560 / 560 | | walk 1 | (613,354)-(615,367) | (639,345)-(640,359) | 579 / 617 | | walk 2 | (654,385)-(655,398) | (639,345)-(640,359) | 601 / 607 | | walk 3 | (649,389)-(650,402) | (639,345)-(640,359) | 608 / 558 | | walk 4 | (619,375)-(620,388) | (639,345)-(640,359) | 604 / 614 | On main the axes move by up to 40 px. With this PR they stay on the same pixels while the hand bobs between y=558 and 617. Standing, both builds draw the same pixels (default FOV 70 = hudFov). **Self-check:** `cargo fmt --check` ok; `cargo clippy -p horizon-client --all-targets -- -D warnings` ok; `cargo test -p horizon-client --lib -- gfx gizmos` 35 passed. Workspace clippy, the full client tests and `tools/parity.py --changed origin/main` run on the combined branch of this batch (results in the thread report). **Note:** vanilla depth-tests the axes against the hand (`LINES` / `LINES_DEPTH_BIAS`); Horizon keeps drawing them on top, as #416 did. That only differs when the hand covers the screen centre. 🤖 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-02 15:57: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#2592
No description provided.