[PR #5920] [MERGED] Shader API: [[materials]] blocks and translucent #6563

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

📋 Pull Request Information

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

Base: main ← Head: shader/material-blocks


📝 Commits (6)

📊 Changes

14 files changed (+134 additions, -14 deletions)

View changed files

📝 crates/horizon-client-render/src/mesher.rs (+10 -2)
📝 crates/horizon-client-render/src/mesher/leaf_culling_tests.rs (+1 -0)
📝 crates/horizon-client-render/src/mesher/reuse_tests.rs (+2 -0)
📝 crates/horizon-client-render/src/streaming.rs (+8 -1)
📝 crates/horizon-client/examples/chunk_load_bench.rs (+1 -0)
📝 crates/horizon-client/examples/probe/section_mesh_fixture.rs (+1 -0)
📝 crates/horizon-client/src/game.rs (+8 -0)
📝 crates/horizon-client/src/game/native_shaders.rs (+22 -4)
📝 crates/horizon-client/src/game/shader_packs.rs (+5 -4)
📝 crates/horizon-client/tests/streaming_meshes.rs (+1 -0)
📝 crates/horizon-client/tests/tall_column.rs (+1 -0)
📝 crates/horizon-shader-api/src/manifest.rs (+42 -2)
📝 crates/horizon-shader-api/tests/schema.rs (+29 -1)
📝 docs/api/shaders.md (+3 -0)

📄 Description

🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally.

Fixes #5919.

What

  • blocks = ["oak_log", "grass_block:snowy=true"] on a [[materials]] entry: the sprites those blocks' models draw with take the id, where no entry's sprites names them. It reuses the block.properties matching and block_id_table that shaders/ packs already go through, so states work the same way. sprites may now be left out.
  • translucent = true: that id's sprites mesh into the translucent pass, sorted and blended, with input.translucent, clear texels and all.
  • MeshSettings holds the layers as an Arc<[bool]>, so it's Clone and no longer Copy. Every section meshes again when the list changes, including when a pack is dropped.

Cost

Without a pack that sets translucent, the list is empty and the mesher does one extra failed slice lookup per quad. blocks costs one block_id_table run when the pack loads, only when a pack lists any. I didn't measure either.

Proof

  • materials_name_blocks_and_move_sprites_to_the_translucent_pass and the refusal cases in tests/schema.rs.
  • In game, single player, a debug pack over stone, planks, cobblestone, iron bars and bricks (shader pack stack_proof 0.1.0: material.wgsl in 113 ms, no validation error):
    • Stone and minecraft:oak_planks by blocks: both show their id's colour.
    • Cobblestone, named by a sprites entry and by a later blocks entry with another id: shows the sprites id.
    • Iron bars with translucent = true: input.translucent is true on their solid texels. Water is true too, as before.
    • Bricks, in no entry: unchanged.
  • Not tested: a block state such as grass_block:snowy=true in game, or the remesh when switching packs in a running game. No screenshot attached: it would show Mojang's textures.

pr_ready (tools/pr_ready.py --quick on teiwazik-laptop, against origin/main at c1f4a7c19, 5 min 48 s)

Check Result
Scope ✅ 13 files, +134 −14
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (35 s)
rustfmt ✅ (8 s)
clippy ✅ (36 s)
tests: horizon-client, horizon-client-render, horizon-shader-api ✅ 2557 passed (4 min 26 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL


🔄 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/5920 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader/material-blocks` --- ### 📝 Commits (6) - [`dc4a9f2`](https://github.com/horizon-rust/horizon/commit/dc4a9f24946b6283b4fef9aa817416fe604c9745) Shader API: [[materials]] blocks and translucent - [`c41d1ee`](https://github.com/horizon-rust/horizon/commit/c41d1ee7b4214f01c85a4c31df548b4bedbf288e) Merge main: the lint fix - [`2947ff9`](https://github.com/horizon-rust/horizon/commit/2947ff96b2e6d7885106f3813e1cee9592fed233) Merge #5920 into the shader API union - [`c80ab3b`](https://github.com/horizon-rust/horizon/commit/c80ab3bbcdbb8ff4bb6c5ff542ee6503eb2b9708) Merge the branch below, with main - [`b0fee0d`](https://github.com/horizon-rust/horizon/commit/b0fee0d30d5998348881719b3e0de4adaa6ab087) Merge main into shader/material-blocks (after #5926) - [`6472b1a`](https://github.com/horizon-rust/horizon/commit/6472b1af4cb4dd9a506b7252634bc7db969342c2) Merge main into shader/material-blocks (after #5900) ### 📊 Changes **14 files changed** (+134 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/mesher.rs` (+10 -2) 📝 `crates/horizon-client-render/src/mesher/leaf_culling_tests.rs` (+1 -0) 📝 `crates/horizon-client-render/src/mesher/reuse_tests.rs` (+2 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+8 -1) 📝 `crates/horizon-client/examples/chunk_load_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/probe/section_mesh_fixture.rs` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+8 -0) 📝 `crates/horizon-client/src/game/native_shaders.rs` (+22 -4) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+5 -4) 📝 `crates/horizon-client/tests/streaming_meshes.rs` (+1 -0) 📝 `crates/horizon-client/tests/tall_column.rs` (+1 -0) 📝 `crates/horizon-shader-api/src/manifest.rs` (+42 -2) 📝 `crates/horizon-shader-api/tests/schema.rs` (+29 -1) 📝 `docs/api/shaders.md` (+3 -0) </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. Fixes #5919. ## What - `blocks = ["oak_log", "grass_block:snowy=true"]` on a `[[materials]]` entry: the sprites those blocks' models draw with take the id, where no entry's `sprites` names them. It reuses the `block.properties` matching and `block_id_table` that `shaders/` packs already go through, so states work the same way. `sprites` may now be left out. - `translucent = true`: that id's sprites mesh into the translucent pass, sorted and blended, with `input.translucent`, clear texels and all. - `MeshSettings` holds the layers as an `Arc<[bool]>`, so it's `Clone` and no longer `Copy`. Every section meshes again when the list changes, including when a pack is dropped. ## Cost Without a pack that sets `translucent`, the list is empty and the mesher does one extra failed slice lookup per quad. `blocks` costs one `block_id_table` run when the pack loads, only when a pack lists any. I didn't measure either. ## Proof - `materials_name_blocks_and_move_sprites_to_the_translucent_pass` and the refusal cases in `tests/schema.rs`. - In game, single player, a debug pack over stone, planks, cobblestone, iron bars and bricks (`shader pack stack_proof 0.1.0: material.wgsl in 113 ms`, no validation error): - Stone and `minecraft:oak_planks` by `blocks`: both show their id's colour. - Cobblestone, named by a `sprites` entry and by a later `blocks` entry with another id: shows the `sprites` id. - Iron bars with `translucent = true`: `input.translucent` is true on their solid texels. Water is true too, as before. - Bricks, in no entry: unchanged. - Not tested: a block state such as `grass_block:snowy=true` in game, or the remesh when switching packs in a running game. No screenshot attached: it would show Mojang's textures. **pr_ready** (`tools/pr_ready.py --quick` on teiwazik-laptop, against origin/main at c1f4a7c19, 5 min 48 s) | Check | Result | | --- | --- | | Scope | ✅ 13 files, +134 −14 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (35 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (36 s) | | tests: horizon-client, horizon-client-render, horizon-shader-api | ✅ 2557 passed (4 min 26 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:23:07 +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#6563
No description provided.