[PR #7800] Shader packs: load terrain material maps with matching texel sampling #7831

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

📋 Pull Request Information

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

Base: main ← Head: feat/terrain-material-maps-20261102


📝 Commits (5)

  • 9c685a4 Load terrain material maps for standard shader packs
  • 307404f test: accept terrain routing notes and satisfy chunk lint
  • 3ed4cb4 test: retain encoded alpha in material pixel fixture
  • 746a3dd test: cover a single inherited rectangular material frame
  • ef4f1a4 fix: retain a single inherited rectangular material frame

📊 Changes

15 files changed (+1390 additions, -90 deletions)

View changed files

📝 crates/horizon-client-render/src/assets.rs (+2 -0)
📝 crates/horizon-client-render/src/gfx.rs (+100 -30)
📝 crates/horizon-client-render/src/gfx/pack_atlas.rs (+3 -0)
➕ crates/horizon-client-render/src/gfx/pack_materials.rs (+99 -0)
➕ crates/horizon-client-render/src/gfx/pack_materials/tests.rs (+114 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+24 -17)
➕ crates/horizon-client-render/src/gfx/pack_post/material_tests.rs (+386 -0)
📝 crates/horizon-client-render/src/hud.rs (+13 -4)
➕ crates/horizon-client-render/src/hud/material_tests.rs (+33 -0)
📝 crates/horizon-client-render/src/sprites.rs (+209 -32)
➕ crates/horizon-client-render/src/sprites/material_tests.rs (+225 -0)
📝 crates/horizon-client/src/game.rs (+14 -2)
📝 crates/horizon-client/src/game/options.rs (+7 -1)
📝 crates/horizon-client/src/game/shader_packs.rs (+49 -4)
➕ crates/horizon-client/src/game/shader_packs/material_tests.rs (+112 -0)

📄 Description

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

Validation status: The final commit passes 23 local material checks and its broad CI verify job. The original public/linear/fixed Renderer contrasts pass; coverage and skipped checks are listed below.

What and why

Standard GLSL packs currently receive flat/black stand-ins for terrain normals and specular, even when a resource pack supplies companions. Load those maps, preserve their encoded RGBA channels and absent-map defaults, and copy them into the colour atlas's matching grid and texture-bank layout. The colour and both material arrays share the configured budget. Material sampling selects the same nearest texels as colour, preventing adjacent tiles from blending encoded material values.

Retain companion-owned animation metadata, inferred colour timelines, static companions and raw-channel mips. Explicit non-square inherited layouts, including a single physical frame, use the decoded capacity at the material's pixel scale; ambiguous square grids require companion metadata so higher-resolution static maps remain intact. Reconcile a shader selection changed during startup once at handoff, and reload maps on explicit shader selection changes.

The terrain change preserves the native first-bank material path and native sprite/HUD APIs. Related native-sprite PR #7319 composes by a clean three-way application; HUD PR #7498 applies directly. These are source-composition checks, separate from runtime validation. Entity/item companion atlases and the other private shader upgrades are separate work.

Fixes #7747.

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

Shader-format compatibility, outside vanilla: texture atlas inputs, LabPBR channel format, and resource-format macros. Original synthetic resources/shaders check channel values, defaults, timelines, layout/budget, discovery, bank copies and sampler edges.

Other projects' code

Extracted from an existing private integration using MIT Horizon source at the public base, public format descriptions and original diagnostics. No third-party implementation or pack assets were read/copied for this extraction or included in the patch. The wider private integration has older pack research in its history; this is not a claim of pristine clean-room history for that entire integration. No external-code notices are added because no external implementation is adapted here.

Self-check

The complete local pr_ready.py command was deferred to share the compiler lease with other fixes. No completed local self-check block is claimed. The actual passing broad CI components for the final tip are recorded below.

  • ef4f1a40b87a807d12db7531f71bcc96a16e39e1: 23 material tests pass on host Vulkan, including real-map/default/explicit-atlas pixels, raw-channel animation/mips, banks, loading/layout/budget/discovery and the new one-frame rectangle. Executables, source snapshots, hashes and test lists were captured inside the compiler lease; no adapter/device skips occurred.
  • The new one-frame fixture fails on unchanged production with two frames instead of one, then passes unchanged after the one-line guard correction. Its distinct top/bottom encoded bytes verify the full frame. The existing square-static/own-grid control passes before and after.
  • The three original layout/budget/discovery controls fail their intended assertions on public bc761767 and pass with the extraction.
  • CI on final ef4f1a40 tip: Python 614 tests; workspace fmt/all-target Clippy plus no-default-features client Clippy; workspace library/binary/integration tests, explicit ignored mod-content tests and doctests pass. Primary client 708 passed/5 ignored; renderer 1183 passed/38 ignored. Startup, format and one-frame rectangle fixtures explicitly pass. Launcher build/tests were path-skipped; parity/JFR jobs were skipped.

Screenshots and controlled Renderer outcomes

The same original synthetic scene and hashed shader/properties inputs produced:

Runtime Exact material pixels Default pixels Contaminated edge pixels
Public bc761767 0 4188 0
Material transport with old linear filtering 4066 0 122
Material transport with matching nearest filtering 4188 0 0
Fixed runtime without maps 0 4188 0

The fixed Renderer control matches the published 3ed4cb4d runtime; the final metadata correction changes only loader frame inference. Four original PNGs and image/binary/fixture hashes were generated and visually checked. Inline attachment hosting is unavailable in this session; the images are retained in the evidence bundle. These fixtures use no player media, game assets or third-party packs. External-pack appearance, live gameplay and backend parity remain untested.

🤖 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/7800 **Author:** [@gigamans442](https://github.com/gigamans442) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/terrain-material-maps-20261102` --- ### 📝 Commits (5) - [`9c685a4`](https://github.com/horizon-rust/horizon/commit/9c685a4a6c5f2931a19f13d9fa3e8018016eac79) Load terrain material maps for standard shader packs - [`307404f`](https://github.com/horizon-rust/horizon/commit/307404f1fe774a9d3a54ba4ec3bbead8f8c7dff2) test: accept terrain routing notes and satisfy chunk lint - [`3ed4cb4`](https://github.com/horizon-rust/horizon/commit/3ed4cb4d21786bfd87d65bf827d86a1cf8ed9ea7) test: retain encoded alpha in material pixel fixture - [`746a3dd`](https://github.com/horizon-rust/horizon/commit/746a3dd99c3208a048f76210f377a9e70044d6b2) test: cover a single inherited rectangular material frame - [`ef4f1a4`](https://github.com/horizon-rust/horizon/commit/ef4f1a40b87a807d12db7531f71bcc96a16e39e1) fix: retain a single inherited rectangular material frame ### 📊 Changes **15 files changed** (+1390 additions, -90 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/assets.rs` (+2 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+100 -30) 📝 `crates/horizon-client-render/src/gfx/pack_atlas.rs` (+3 -0) ➕ `crates/horizon-client-render/src/gfx/pack_materials.rs` (+99 -0) ➕ `crates/horizon-client-render/src/gfx/pack_materials/tests.rs` (+114 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+24 -17) ➕ `crates/horizon-client-render/src/gfx/pack_post/material_tests.rs` (+386 -0) 📝 `crates/horizon-client-render/src/hud.rs` (+13 -4) ➕ `crates/horizon-client-render/src/hud/material_tests.rs` (+33 -0) 📝 `crates/horizon-client-render/src/sprites.rs` (+209 -32) ➕ `crates/horizon-client-render/src/sprites/material_tests.rs` (+225 -0) 📝 `crates/horizon-client/src/game.rs` (+14 -2) 📝 `crates/horizon-client/src/game/options.rs` (+7 -1) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+49 -4) ➕ `crates/horizon-client/src/game/shader_packs/material_tests.rs` (+112 -0) </details> ### 📄 Description > 🤖 Opened by gigamans442's AI agent (Codex, gpt-6.1-sol), not by gigamans442 personally. > **Validation status:** The final commit passes 23 local material checks and its broad CI verify job. The original public/linear/fixed Renderer contrasts pass; coverage and skipped checks are listed below. ## What and why Standard GLSL packs currently receive flat/black stand-ins for terrain `normals` and `specular`, even when a resource pack supplies companions. Load those maps, preserve their encoded RGBA channels and absent-map defaults, and copy them into the colour atlas's matching grid and texture-bank layout. The colour and both material arrays share the configured budget. Material sampling selects the same nearest texels as colour, preventing adjacent tiles from blending encoded material values. Retain companion-owned animation metadata, inferred colour timelines, static companions and raw-channel mips. Explicit non-square inherited layouts, including a single physical frame, use the decoded capacity at the material's pixel scale; ambiguous square grids require companion metadata so higher-resolution static maps remain intact. Reconcile a shader selection changed during startup once at handoff, and reload maps on explicit shader selection changes. The terrain change preserves the native first-bank material path and native sprite/HUD APIs. Related native-sprite PR #7319 composes by a clean three-way application; HUD PR #7498 applies directly. These are source-composition checks, separate from runtime validation. Entity/item companion atlases and the other private shader upgrades are separate work. Fixes #7747. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [x] 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 Shader-format compatibility, outside vanilla: [texture atlas inputs](https://shaders.properties/current/reference/buffers/atlases/), [LabPBR channel format](https://shaderlabs.org/wiki/LabPBR_Material_Standard), and [resource-format macros](https://shaders.properties/current/reference/macros/mc_texture_format_lab_pbr/). Original synthetic resources/shaders check channel values, defaults, timelines, layout/budget, discovery, bank copies and sampler edges. ## Other projects' code Extracted from an existing private integration using [MIT Horizon source at the public base](https://github.com/horizon-rust/horizon/tree/bc761767d35d4fdc1f4b1144fa8ab75168ed4d14), public format descriptions and original diagnostics. No third-party implementation or pack assets were read/copied for this extraction or included in the patch. The wider private integration has older pack research in its history; this is not a claim of pristine clean-room history for that entire integration. No external-code notices are added because no external implementation is adapted here. ## Self-check The complete local `pr_ready.py` command was deferred to share the compiler lease with other fixes. No completed local self-check block is claimed. The actual passing broad CI components for the final tip are recorded below. - `ef4f1a40b87a807d12db7531f71bcc96a16e39e1`: 23 material tests pass on host Vulkan, including real-map/default/explicit-atlas pixels, raw-channel animation/mips, banks, loading/layout/budget/discovery and the new one-frame rectangle. Executables, source snapshots, hashes and test lists were captured inside the compiler lease; no adapter/device skips occurred. - The new one-frame fixture fails on unchanged production with two frames instead of one, then passes unchanged after the one-line guard correction. Its distinct top/bottom encoded bytes verify the full frame. The existing square-static/own-grid control passes before and after. - The three original layout/budget/discovery controls fail their intended assertions on public `bc761767` and pass with the extraction. - [CI on final ef4f1a40 tip](https://github.com/horizon-rust/horizon/actions/runs/41533459730): Python 614 tests; workspace fmt/all-target Clippy plus no-default-features client Clippy; workspace library/binary/integration tests, explicit ignored mod-content tests and doctests pass. Primary client 708 passed/5 ignored; renderer 1183 passed/38 ignored. Startup, format and one-frame rectangle fixtures explicitly pass. Launcher build/tests were path-skipped; parity/JFR jobs were skipped. ## Screenshots and controlled Renderer outcomes The same original synthetic scene and hashed shader/properties inputs produced: | Runtime | Exact material pixels | Default pixels | Contaminated edge pixels | | --- | ---: | ---: | ---: | | Public bc761767 | 0 | 4188 | 0 | | Material transport with old linear filtering | 4066 | 0 | 122 | | Material transport with matching nearest filtering | 4188 | 0 | 0 | | Fixed runtime without maps | 0 | 4188 | 0 | The fixed Renderer control matches the published 3ed4cb4d runtime; the final metadata correction changes only loader frame inference. Four original PNGs and image/binary/fixture hashes were generated and visually checked. Inline attachment hosting is unavailable in this session; the images are retained in the evidence bundle. These fixtures use no player media, game assets or third-party packs. External-pack appearance, live gameplay and backend parity remain untested. 🤖 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#7831
No description provided.