[PR #7246] [MERGED] Shader packs: Iris's BLOCK_EMISSION_ATTRIBUTE, the block's light in at_midBlock.w #7441

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/block-emission-attribute


📝 Commits (2)

  • f183e70 Shader packs: Iris's BLOCK_EMISSION_ATTRIBUTE, the block's light in at_midBlock.w
  • bf7fbcb Merge main into #7246

📊 Changes

5 files changed (+166 additions, -18 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+2 -1)
📝 crates/horizon-client-render/src/gfx/pack_atlas.rs (+8 -5)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+6 -4)
📝 crates/horizon-client/src/game/shader_packs.rs (+129 -3)
📝 crates/horizon-shaders/src/macros.rs (+21 -5)

📄 Description

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

What and why

Fixes #7205.

iris.features.required/optional may name BLOCK_EMISSION_ATTRIBUTE (Iris ShaderDoc, "Feature Flags": "recommended, but not required for Block Emission: at_midBlock.w"). Horizon left terrain's at_midBlock.w at 0 and logged "the pack requires BLOCK_EMISSION_ATTRIBUTE, which is not supported yet" for RenderPearl v2.7.2 and Visual Vibrance v0.3.5a.

What Iris passes, measured with a probe pack written for this:

  • The probe's gbuffers_terrain paints each block with its at_midBlock.w (red = w/15, green = w/255, blue = w clamped to 0–1).
  • Its final shows whether IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE is defined.
  • It looks at a row of blocks placed with setblock in open sky, in Iris 1.11.7 + Sodium 0.9.2 on 26.3, and in Horizon.

The value is the block's light level, a plain number from 0 to 15:

Block (front face) Iris 1.11.7 main (6d91fa694 build) this branch (built before its rebase onto 0f0fa62dc)
stone, redstone_lamp[lit=false], furnace[lit=false] 0 0 0
glowstone, jack_o_lantern, sea lantern 15 0 15
torch 14 0 14
furnace[lit=true] 13 0 13
soul torch 10 0 10
redstone_torch[lit=true] 7 0 7
redstone_torch[lit=false] as placed 7 0 7
IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE defined not defined defined

The redstone_torch[lit=false] row reads 7 in Iris and here, presumably because the torch turned itself back on after setblock; I didn't check that.

How: terrain vertices carry their sprite layer, not their block. So the light travels the way mc_Entity already does, in the per-layer table of flat terrain (set 3):

  • The table now holds three values per layer: id, fluid, light. at_midBlock.w reads the third.
  • A layer takes the light of the block named like its sprite. Otherwise it takes what most states drawing it give, with ties going to the lower value. This is the same vote block_id_table makes for mc_Entity.
  • The light comes from each state's MeshFacts::emission.
  • Horizon's own packs keep their two-value table (native_shaders.rs).
  • The flag joins FEATURES.

Known mismatch, inherent to a per-sprite table: a sprite that blocks of different light share reads the majority's light. In the probe, the jack o'lantern's side (pumpkin_side, which pumpkins and carved pumpkins share) reads 0 here and 15 in Iris. A lit furnace's sides and top (shared with the unlit furnace) presumably read 0 for the same reason; the probe only looked at its front, so that isn't checked. Matching Iris on every face would mean carrying the light in each terrain vertex, a change to TerrainVertex that every terrain draw would pay for. I left that out.

A separate thing seen in the probe: Horizon's top left corner comes out at 185 of 255 on main and 187 here, where the shader paints 255. That's darkening near the edge which I haven't diagnosed, and which this change doesn't touch.

Measured: real_packs over Modrinth's 40 most-downloaded packs, main 0f0fa62dc vs this branch, SHOW_ERRORS=1. Apart from timings, the only difference is that the note "the pack requires BLOCK_EMISSION_ATTRIBUTE, which is not supported yet" is gone, three times each for RenderPearl and Visual Vibrance. Nothing translates differently.

Tests:

  • macros::tests::block_emission_attribute_is_a_feature: defined when optional, no note when required. I ran it on main's code and it fails there.
  • game::shader_packs::emission_tests::a_sprite_takes_the_light_of_its_block: the layer vote, including a named sprite, a tie and an undrawn layer.
  • game::shader_packs::emission_tests::the_terrain_table_holds_ids_then_light: three values per layer.

The last two are new functions, absent on main.

Rebased onto main after #7204 (SEPARATE_HARDWARE_SAMPLERS) merged; both add a flag to FEATURES.

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-only (shader packs; vanilla has no such feature). Sources: Iris ShaderDoc ("Feature Flags"), and black-box runs of Iris 1.11.7 with a probe pack of our own.

Other projects' code

none. No Iris, OptiFine or pack code read.

Self-check

pr_ready (tools/pr_ready.py --quick on plony-pc, against origin/main at 0f0fa62dc, 3 min 45 s)

Check Result
Scope ✅ 5 files, +166 −18
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (47 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 6 s)
tests: horizon-client, horizon-client-render, horizon-shaders ✅ 1988 passed (1 min 30 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
mod API up to date ✅ (12 s)
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


🔄 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/7246 **Author:** [@arslanarm](https://github.com/arslanarm) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/block-emission-attribute` --- ### 📝 Commits (2) - [`f183e70`](https://github.com/horizon-rust/horizon/commit/f183e706f5f6176b36c29d60afcdce6edd794016) Shader packs: Iris's BLOCK_EMISSION_ATTRIBUTE, the block's light in at_midBlock.w - [`bf7fbcb`](https://github.com/horizon-rust/horizon/commit/bf7fbcb7ebe2e7fe7f1090eb0e5d7a9c3aa43d06) Merge main into #7246 ### 📊 Changes **5 files changed** (+166 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+2 -1) 📝 `crates/horizon-client-render/src/gfx/pack_atlas.rs` (+8 -5) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+6 -4) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+129 -3) 📝 `crates/horizon-shaders/src/macros.rs` (+21 -5) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #7205. `iris.features.required`/`optional` may name `BLOCK_EMISSION_ATTRIBUTE` (Iris ShaderDoc, "Feature Flags": "recommended, but not required for Block Emission: `at_midBlock.w`"). Horizon left terrain's `at_midBlock.w` at 0 and logged "the pack requires `BLOCK_EMISSION_ATTRIBUTE`, which is not supported yet" for RenderPearl v2.7.2 and Visual Vibrance v0.3.5a. **What Iris passes**, measured with a probe pack written for this: - The probe's `gbuffers_terrain` paints each block with its `at_midBlock.w` (red = w/15, green = w/255, blue = w clamped to 0–1). - Its `final` shows whether `IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE` is defined. - It looks at a row of blocks placed with `setblock` in open sky, in Iris 1.11.7 + Sodium 0.9.2 on 26.3, and in Horizon. The value is the block's light level, a plain number from 0 to 15: | Block (front face) | Iris 1.11.7 | main (6d91fa694 build) | this branch (built before its rebase onto 0f0fa62dc) | | --- | --- | --- | --- | | stone, `redstone_lamp[lit=false]`, `furnace[lit=false]` | 0 | 0 | 0 | | glowstone, `jack_o_lantern`, sea lantern | 15 | 0 | 15 | | torch | 14 | 0 | 14 | | `furnace[lit=true]` | 13 | 0 | 13 | | soul torch | 10 | 0 | 10 | | `redstone_torch[lit=true]` | 7 | 0 | 7 | | `redstone_torch[lit=false]` as placed | 7 | 0 | 7 | | `IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE` | defined | not defined | defined | The `redstone_torch[lit=false]` row reads 7 in Iris and here, presumably because the torch turned itself back on after `setblock`; I didn't check that. **How:** terrain vertices carry their sprite layer, not their block. So the light travels the way `mc_Entity` already does, in the per-layer table of flat terrain (set 3): - The table now holds three values per layer: id, fluid, light. `at_midBlock.w` reads the third. - A layer takes the light of the block named like its sprite. Otherwise it takes what most states drawing it give, with ties going to the lower value. This is the same vote `block_id_table` makes for `mc_Entity`. - The light comes from each state's `MeshFacts::emission`. - Horizon's own packs keep their two-value table (`native_shaders.rs`). - The flag joins `FEATURES`. **Known mismatch**, inherent to a per-sprite table: a sprite that blocks of different light share reads the majority's light. In the probe, the jack o'lantern's side (`pumpkin_side`, which pumpkins and carved pumpkins share) reads 0 here and 15 in Iris. A lit furnace's sides and top (shared with the unlit furnace) presumably read 0 for the same reason; the probe only looked at its front, so that isn't checked. Matching Iris on every face would mean carrying the light in each terrain vertex, a change to `TerrainVertex` that every terrain draw would pay for. I left that out. A separate thing seen in the probe: Horizon's top left corner comes out at 185 of 255 on main and 187 here, where the shader paints 255. That's darkening near the edge which I haven't diagnosed, and which this change doesn't touch. **Measured:** `real_packs` over Modrinth's 40 most-downloaded packs, main 0f0fa62dc vs this branch, `SHOW_ERRORS=1`. Apart from timings, the only difference is that the note "the pack requires `BLOCK_EMISSION_ATTRIBUTE`, which is not supported yet" is gone, three times each for RenderPearl and Visual Vibrance. Nothing translates differently. Tests: - `macros::tests::block_emission_attribute_is_a_feature`: defined when optional, no note when required. I ran it on main's code and it fails there. - `game::shader_packs::emission_tests::a_sprite_takes_the_light_of_its_block`: the layer vote, including a named sprite, a tie and an undrawn layer. - `game::shader_packs::emission_tests::the_terrain_table_holds_ids_then_light`: three values per layer. The last two are new functions, absent on main. Rebased onto main after #7204 (`SEPARATE_HARDWARE_SAMPLERS`) merged; both add a flag to `FEATURES`. ## 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-only (shader packs; vanilla has no such feature). Sources: Iris ShaderDoc ("Feature Flags"), and black-box runs of Iris 1.11.7 with a probe pack of our own. ## Other projects' code none. No Iris, OptiFine or pack code read. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at 0f0fa62dc, 3 min 45 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +166 −18 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (47 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 6 s) | | tests: horizon-client, horizon-client-render, horizon-shaders | ✅ 1988 passed (1 min 30 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (12 s) | | 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:39:33 +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#7441
No description provided.