[PR #6999] [MERGED] Work out item and block-model face normals once per pose #7260

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

📋 Pull Request Information

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

Base: main ← Head: perf/item-quad-normals


📝 Commits (1)

  • cde41da Work out item and block-model face normals once per pose

📊 Changes

2 files changed (+69 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game/minecarts.rs (+2 -2)
📝 crates/horizon-client/src/item_render.rs (+67 -3)

📄 Description

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

Item quads (dropped items, held items, item frames, armour stands' hands) and baked block models on entities (minecarts, endermen, TNT…) inverted the pose's 3×3 matrix for every quad (transform_normal), though every quad of a layer shares that pose. A dropped generated item has ~42 quads.

FaceNormals inverts it once per pose and keeps the normal of each of the six facings the first time a quad uses it. The arithmetic is the same calls in the same order, so the vertices are the same bits; the new test checks every facing against an f64 inverse transpose, and against transform_normal.

A/B

Submitting the ground state of the stress_items scene's 8 items, 2000 items (336 000 vertices), through ItemRenderState::submit into a WorldSink: a scratch bench on the real 26.3 resources, best of 40 rounds, --profile fast, playhorizon (shared VPS, 4 build cores). The bench is not committed.

Run main this PR vertex checksum
pair 1 5.892 ms 4.841 ms identical (97b2686d942044)
pair 2 5.867 ms 4.790 ms identical
change −18 %

Not measured: the frame-time A/B of stress_items on the Mac mini. Its disk is at 9–11 GB, under the 25 GB floor for benches; it will follow in perf-entities' record once there is room.

Checks (playhorizon, head cde41dabb)

cargo fmt --all -- --check                                   ok
cargo clippy --profile fast -p horizon-client -p horizon-client-lib -p horizon-client-render --lib --bins --tests -- -D warnings   ok, 0 diagnostics
cargo test -p horizon-client-lib --lib item_render           35 passed
cargo test -p horizon-client --lib minecarts                 11 passed

Harnesses: tools/parity.py --changed-files lists 137 (gameplay dep-info); left to CI's parity job.

🤖 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/6999 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/item-quad-normals` --- ### 📝 Commits (1) - [`cde41da`](https://github.com/horizon-rust/horizon/commit/cde41dabbf27ecb71172d3253db2845a2bbc29b7) Work out item and block-model face normals once per pose ### 📊 Changes **2 files changed** (+69 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/minecarts.rs` (+2 -2) 📝 `crates/horizon-client/src/item_render.rs` (+67 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Item quads (dropped items, held items, item frames, armour stands' hands) and baked block models on entities (minecarts, endermen, TNT…) inverted the pose's 3×3 matrix for **every quad** (`transform_normal`), though every quad of a layer shares that pose. A dropped generated item has ~42 quads. `FaceNormals` inverts it once per pose and keeps the normal of each of the six facings the first time a quad uses it. The arithmetic is the same calls in the same order, so the vertices are the same bits; the new test checks every facing against an f64 inverse transpose, and against `transform_normal`. ### A/B Submitting the ground state of the `stress_items` scene's 8 items, 2000 items (336 000 vertices), through `ItemRenderState::submit` into a `WorldSink`: a scratch bench on the real 26.3 resources, best of 40 rounds, `--profile fast`, playhorizon (shared VPS, 4 build cores). The bench is not committed. | Run | main | this PR | vertex checksum | |---|---|---|---| | pair 1 | 5.892 ms | 4.841 ms | identical (`97b2686d942044`) | | pair 2 | 5.867 ms | 4.790 ms | identical | | **change** | | **−18 %** | | Not measured: the frame-time A/B of `stress_items` on the Mac mini. Its disk is at 9–11 GB, under the 25 GB floor for benches; it will follow in perf-entities' record once there is room. ### Checks (playhorizon, head cde41dabb) ``` cargo fmt --all -- --check ok cargo clippy --profile fast -p horizon-client -p horizon-client-lib -p horizon-client-render --lib --bins --tests -- -D warnings ok, 0 diagnostics cargo test -p horizon-client-lib --lib item_render 35 passed cargo test -p horizon-client --lib minecarts 11 passed ``` Harnesses: `tools/parity.py --changed-files` lists 137 (gameplay dep-info); left to CI's parity job. 🤖 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 06:36:36 +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#7260
No description provided.