[PR #7797] Shader packs: use each terrain quad's UV centre for mc_midTexCoord #7827

Open
opened 2026-11-03 07:24:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7797
Author: @gigamans442
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/per-face-uv-centre-20261102


📝 Commits (1)

  • 9c09b12 Fix terrain mc_midTexCoord for partial quads

📊 Changes

2 files changed (+368 additions, -3 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/pack_atlas.rs (+15 -3)
➕ crates/horizon-client-render/src/gfx/pack_atlas/midpoint_test.rs (+353 -0)

📄 Description

🤖 Opened by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally.

What and why

Fixes #7745.

Translated terrain programs currently receive the entire atlas tile's centre for mc_midTexCoord. A half-height face covering local UVs (0,0) to (1,0.5) therefore receives (0.5,0.5) instead of (0.5,0.25), giving effects that reconstruct face-local texture bounds the wrong input.

Average all four of the current quad's mapped UV corners before the existing atlas cell/scale transform. Reuse the same UV scale/clamp as the vertex texture coordinates. Keep the existing whole-tile fallback for non-flat draws. Atlas layout, vertex format and tangent calculation are unchanged.

The original offscreen GPU regression runs generated production inputs for terrain and shadow programs. It checks every corner of full, half-height, rotated partial, clamped and non-rectangular UV quads; both origin-scale encodings; atlas cells in both rows; and the non-flat fallback. Expected values are fixed independently of the implementation.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon's translated shader-pack attribute, with no vanilla equivalent. The public format documentation specifies the centre of the current quad's covered texture region, including slab faces. No gameplay or vanilla class/method changes.

Other projects' code

Production code is Horizon's MIT-licensed pack_atlas.rs, extracted onto public main bc761767d35d4fdc1f4b1144fa8ab75168ed4d14. This small correction was first implemented in a private Skyline branch using Horizon source, public attribute documentation and original diagnostic probes. That broader private branch has earlier shader-pack research in its history; this PR does not claim pristine clean-room provenance for that branch. No private commit history, shader-pack implementation/source assets, game resources or unrelated customizations are included. The GPU regression and its inline shader are original synthetic code.

For the original test fixture, the texture-format API capability declarations were consulted in wgpu-types 30.0.1 at 40f4a34, licensed MIT OR Apache-2.0 (both packaged license files checked). No implementation was copied or adapted from it.

Self-check

Actual verification evidence (CI and focused host GPU; not a local pr_ready block)

GitHub Actions verify succeeded on head 9c09b12c6120b950a8a46c0e6a818e50c016fe43 merged into main 3fc4c4ca050109ab912ac786209303c62265b605 (merge a5513dff8), with stable Rust 1.99.1.

Check Actual result
Public tree and contribution commit range Both CI scans passed; local history scan also passed
Python tests 614 passed
Formatting cargo +stable fmt --all -- --check passed
Workspace Clippy cargo +stable clippy --workspace --all-targets -- -D warnings passed
Server Clippy cargo +stable clippy -p horizon-client --all-targets --no-default-features -- -D warnings passed
Workspace Rust targets cargo +stable test --workspace --lib --bins --tests passed; touched renderer: 1,172 passed, 0 failed, 38 ignored, including the new midpoint regression
Doc tests cargo +stable test --workspace --doc passed; renderer: 0 doctests
Focused actual GPU regression Intel Arc A770 / Vulkan / Mesa 26.2.4: pre-fix 64 wrong centre samples / 160 with 96 controls; fixed 160 / 160 match. Identical expected-value test file; source/head stable
Lock/generated surfaces No manifest, lockfile, content-root, native-hook or theme files changed; focused local build used --locked
Launcher CI job passed; launcher Rust checks were not selected for this renderer-only change
Vanilla parity CI parity jobs skipped; no vanilla harness run or universal visual parity claimed

tools/pr_ready.py was not run locally and emitted no block. The completed CI commands cover its applicable formatting, lint, Python, touched-crate and doc-test checks; the local focused GPU probe supplies explicit Arc/Vulkan coverage. Initial fixture setup errors and the deliberately cancelled waiting combined job are kept separate from valid test results.

Screenshots

The regression reads exact float coordinates from an original offscreen diagnostic shader; it does not use a player screenshot or third-party pack. Fixture success verifies this input contract, not every pack's visual appearance or gameplay FPS.

Maintainer edits are enabled.

🤖 Generated with Codex.


🔄 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/7797 **Author:** [@gigamans442](https://github.com/gigamans442) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/per-face-uv-centre-20261102` --- ### 📝 Commits (1) - [`9c09b12`](https://github.com/horizon-rust/horizon/commit/9c09b12c6120b950a8a46c0e6a818e50c016fe43) Fix terrain mc_midTexCoord for partial quads ### 📊 Changes **2 files changed** (+368 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/pack_atlas.rs` (+15 -3) ➕ `crates/horizon-client-render/src/gfx/pack_atlas/midpoint_test.rs` (+353 -0) </details> ### 📄 Description > 🤖 Opened by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. ## What and why Fixes #7745. Translated terrain programs currently receive the entire atlas tile's centre for `mc_midTexCoord`. A half-height face covering local UVs `(0,0)` to `(1,0.5)` therefore receives `(0.5,0.5)` instead of `(0.5,0.25)`, giving effects that reconstruct face-local texture bounds the wrong input. Average all four of the current quad's mapped UV corners before the existing atlas cell/scale transform. Reuse the same UV scale/clamp as the vertex texture coordinates. Keep the existing whole-tile fallback for non-flat draws. Atlas layout, vertex format and tangent calculation are unchanged. The original offscreen GPU regression runs generated production inputs for terrain and shadow programs. It checks every corner of full, half-height, rotated partial, clamped and non-rectangular UV quads; both origin-scale encodings; atlas cells in both rows; and the non-flat fallback. Expected values are fixed independently of the implementation. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon's translated shader-pack attribute, with no vanilla equivalent. The [public format documentation](https://shaders.properties/current/reference/attributes/mc_midtexcoord/) specifies the centre of the current quad's covered texture region, including slab faces. No gameplay or vanilla class/method changes. ## Other projects' code Production code is Horizon's MIT-licensed `pack_atlas.rs`, extracted onto public main `bc761767d35d4fdc1f4b1144fa8ab75168ed4d14`. This small correction was first implemented in a private Skyline branch using Horizon source, public attribute documentation and original diagnostic probes. That broader private branch has earlier shader-pack research in its history; this PR does not claim pristine clean-room provenance for that branch. No private commit history, shader-pack implementation/source assets, game resources or unrelated customizations are included. The GPU regression and its inline shader are original synthetic code. For the original test fixture, the texture-format API capability declarations were consulted in [wgpu-types 30.0.1 at `40f4a34`](https://github.com/gfx-rs/wgpu/blob/40f4a34ebaf56f9a046231f54125ad046239d3f3/wgpu-types/src/texture/format.rs), licensed MIT OR Apache-2.0 (both packaged license files checked). No implementation was copied or adapted from it. ## Self-check **Actual verification evidence (CI and focused host GPU; not a local `pr_ready` block)** [GitHub Actions verify](https://github.com/horizon-rust/horizon/actions/runs/41524356801/job/125549023211) succeeded on head `9c09b12c6120b950a8a46c0e6a818e50c016fe43` merged into main `3fc4c4ca050109ab912ac786209303c62265b605` (merge `a5513dff8`), with stable Rust 1.99.1. | Check | Actual result | | --- | --- | | Public tree and contribution commit range | Both CI scans passed; local history scan also passed | | Python tests | 614 passed | | Formatting | `cargo +stable fmt --all -- --check` passed | | Workspace Clippy | `cargo +stable clippy --workspace --all-targets -- -D warnings` passed | | Server Clippy | `cargo +stable clippy -p horizon-client --all-targets --no-default-features -- -D warnings` passed | | Workspace Rust targets | `cargo +stable test --workspace --lib --bins --tests` passed; touched renderer: 1,172 passed, 0 failed, 38 ignored, including the new midpoint regression | | Doc tests | `cargo +stable test --workspace --doc` passed; renderer: 0 doctests | | Focused actual GPU regression | Intel Arc A770 / Vulkan / Mesa 26.2.4: pre-fix 64 wrong centre samples / 160 with 96 controls; fixed 160 / 160 match. Identical expected-value test file; source/head stable | | Lock/generated surfaces | No manifest, lockfile, content-root, native-hook or theme files changed; focused local build used `--locked` | | Launcher | CI job passed; launcher Rust checks were not selected for this renderer-only change | | Vanilla parity | CI parity jobs skipped; no vanilla harness run or universal visual parity claimed | `tools/pr_ready.py` was not run locally and emitted no block. The completed CI commands cover its applicable formatting, lint, Python, touched-crate and doc-test checks; the local focused GPU probe supplies explicit Arc/Vulkan coverage. Initial fixture setup errors and the deliberately cancelled waiting combined job are kept separate from valid test results. ## Screenshots The regression reads exact float coordinates from an original offscreen diagnostic shader; it does not use a player screenshot or third-party pack. Fixture success verifies this input contract, not every pack's visual appearance or gameplay FPS. Maintainer edits are enabled. 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7827
No description provided.