[GH-ISSUE #7745] Shader packs: mc_midTexCoord uses the whole tile centre on partial terrain faces #3350

Open
opened 2026-11-03 04:07:43 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @gigamans442 on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7745

Originally assigned to: @gigamans442 on GitHub.

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

On public main bc761767d35d4fdc1f4b1144fa8ab75168ed4d14, translated terrain programs receive the whole atlas tile's centre for mc_midTexCoord, even when the current quad covers only part of that tile. This can give shader effects that reconstruct face-local UV bounds the wrong centre on slabs/stairs or custom partial faces.

Minimal original reproduction: use a four-vertex terrain quad with local UV corners (0,0), (1,0), (1,0.5), (0,0.5), and a diagnostic vertex shader that forwards mc_midTexCoord.xy to an output. Expected local centre: (0.5,0.25), then the existing atlas cell/scale transform. Current PackAtlas::terrain_inputs always emits (cell + 0.5) * scale, giving local (0.5,0.5) instead. The same attribute is used by terrain and terrain shadow programs.

The public attribute documentation describes the centre of the current quad's covered texture region, including partial slab faces.

An isolated private local fix and original GPU probe already reproduce/fix this discrepancy. I will extract only that small UV-centre correction onto fresh public history, preserve current UV clamping/atlas layout, and add original partial, rotated and clamped-UV regressions. No shader-pack assets or implementation source will be included. Earlier private shader research exists; this report does not claim pristine clean-room history for that private branch.

🤖 Generated with Codex.

Originally created by @gigamans442 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7745 Originally assigned to: @gigamans442 on GitHub. > 🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. On public main `bc761767d35d4fdc1f4b1144fa8ab75168ed4d14`, translated terrain programs receive the whole atlas tile's centre for `mc_midTexCoord`, even when the current quad covers only part of that tile. This can give shader effects that reconstruct face-local UV bounds the wrong centre on slabs/stairs or custom partial faces. Minimal original reproduction: use a four-vertex terrain quad with local UV corners `(0,0)`, `(1,0)`, `(1,0.5)`, `(0,0.5)`, and a diagnostic vertex shader that forwards `mc_midTexCoord.xy` to an output. Expected local centre: `(0.5,0.25)`, then the existing atlas cell/scale transform. Current `PackAtlas::terrain_inputs` always emits `(cell + 0.5) * scale`, giving local `(0.5,0.5)` instead. The same attribute is used by terrain and terrain shadow programs. The [public attribute documentation](https://shaders.properties/current/reference/attributes/mc_midtexcoord/) describes the centre of the current quad's covered texture region, including partial slab faces. An isolated private local fix and original GPU probe already reproduce/fix this discrepancy. I will extract only that small UV-centre correction onto fresh public history, preserve current UV clamping/atlas layout, and add original partial, rotated and clamped-UV regressions. No shader-pack assets or implementation source will be included. Earlier private shader research exists; this report does not claim pristine clean-room history for that private branch. 🤖 Generated with [Codex](https://openai.com/codex/).
Author
Owner

@gigamans442 commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6587367705 --> @gigamans442 commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#3350
No description provided.