[PR #6457] [MERGED] OptiFine emissive textures: blocks glow too #6888

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

📋 Pull Request Information

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

Base: main ← Head: optifine/etf-blocks-glow


📝 Commits (10+)

  • d27c2b4 OptiFine emissive textures: armour stands, elytra and the dragon glow too
  • cba084f OptiFine emissive textures: read the overlays where armour stands draw their armour
  • 69be592 OptiFine emissive and ETF blinking: the gaps the merged PRs' last reviews found
  • 7cf29b6 OptiFine emissive textures: blocks glow too
  • 1b896eb OptiFine emissive textures: only block sprites pair for the terrain
  • dfc2b8b OptiFine emissive textures: a blink frame glows with its own overlay only
  • 514d4b0 OptiFine emissive textures: test a variant blink frame's overlay in the atlas, fix the docs row
  • facacb2 OptiFine emissive textures: cutout block overlays, native mods kept to 32, safer pairing
  • 2c01240 Merge optifine/etf-followups into optifine/etf-blocks-glow
  • 742df9f OptiFine emissive textures: thrown tridents glow where the game draws them

📊 Changes

16 files changed (+582 additions, -78 deletions)

View changed files

📝 crates/horizon-client-render/src/assets.rs (+9 -0)
📝 crates/horizon-client-render/src/entity.wgsl (+1 -1)
📝 crates/horizon-client-render/src/hud.rs (+71 -13)
📝 crates/horizon-client-render/src/native_emissive.rs (+196 -3)
📝 crates/horizon-client-render/src/sprites.rs (+8 -0)
📝 crates/horizon-client-render/src/terrain.wgsl (+15 -5)
📝 crates/horizon-client/src/game.rs (+4 -4)
📝 crates/horizon-client/src/game/armor_stands.rs (+37 -0)
📝 crates/horizon-client/src/game/dragon.rs (+13 -0)
📝 crates/horizon-client/src/game/perspective.rs (+40 -11)
📝 crates/horizon-client/src/game/trident.rs (+23 -0)
📝 crates/horizon-client/src/mobs/data.rs (+5 -4)
📝 crates/horizon-client/src/mobs/render.rs (+67 -3)
📝 crates/horizon-optifine/src/blink.rs (+21 -1)
📝 crates/horizon-optifine/src/emissive.rs (+69 -33)
📝 docs/resource-packs.md (+3 -0)

📄 Description

OptiFine's emissive textures also cover blocks: a stone_e.png beside stone.png holds the pixels that glow, as glowing ores, runes and lamps do in many packs. Mobs and block entities glow in Horizon now, but placed blocks didn't. With this PR, blocks glow too.

What players get:

  • Every block texture the world draws that has <name><suffix>.png beside it (suffix from optifine/emissive.properties, _e without one) draws that overlay at full brightness over the texture, as OptiFine does.
  • The overlay is drawn in the same fragment as the block, on top of its lit colour, cutout as OptiFine draws SOLID textures' overlays: opaque where its alpha is at least 0.1. Light, ambient occlusion and the tint don't dim it; fog still applies. In HDR output the glowing pixels shine like vanilla's light sources.
  • No _e block textures: nothing changes. Vanilla ships none under textures/block/.

How: Horizon already has this overlay path for native mods' emissive/ textures. A table of base-layer and overlay-layer pairs sits in the terrain shader's globals, and solid_finish mixes the overlay in.

  • native_emissive::load_optifine runs at pack load, after the block models' sprites are in. For each loaded block/ sprite with an overlay file beside it, it loads the overlay into the sprite array and pairs the two by name.
  • RenderAssets.emissive keeps the pairs. Each frame, native_emissive::table builds the shader's table: native mods' pairs first (still at most 32, as their API documents), then the OptiFine pairs (at most 96, so the 32 native pairs always fit), flagged cutout in the overlay layer's high bit, one per base layer, sorted by base layer.
  • The terrain shader's per-vertex search stops at the first larger base layer, so most vertices stop after a step or two instead of scanning the table.
  • The table grows from 32 to 128 pairs (Globals, terrain.wgsl, entity.wgsl).
  • An overlay that doesn't load (a broken PNG or .mcmeta) is skipped with a warning, not drawn as the glowing missing texture. Pairs past the cap and files over 1 MiB are logged too.
  • Blocks whose textures have identical pixels share one sprite layer, and the shader pairs by layer, so a shared base gets no overlay rather than glowing on every block that shares it. The pairing runs after the connected-texture tiles load, so a tile identical to a block counts as sharing too.
  • horizon_optifine::emissive::suffix is now shared with the entity overlays.

Limits:

  • At most 96 block overlays (the table's 128 less native mods' 32).
  • No overlays on connected-texture tiles: CTM swaps the layer.
  • No overlays on translucent faces: the shader's translucent path has no overlay.
  • Items in hand and in the GUI draw from the HUD atlas, so they aren't covered.

Docs I wrote it from (no mod source read): OptiFine's OptiFineDoc/doc/emissive.properties ("The emissive overlays are rendered in the same block layer as the base texture").

Checks:

  • cargo fmt: clean
  • Tests in native_emissive:
    • optifine_overlays_pair_with_their_loaded_blocks pairs a loaded stone with its stone_e; nothing for an overlay whose block isn't loaded, an item texture, a broken overlay file, or two blocks sharing a layer; a pack's own _glow suffix.
    • the_table_keeps_native_pairs_first_and_flags_optifine_cutout: a native pair beats the pack's on the same base, the pack's other pair carries the cutout flag, the table is sorted by base layer, and 40 native requests on 40 bases are cut to the first 32.
  • CI on my fork (verify): run linked in a comment once it finishes.
  • Not run: no live game test (no .local/ vanilla data here), so the review-loop's live step is skipped.

Stacked on #6454; this branch includes its commit until it merges.

Note

Filed by Opus 5.5 using 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/6457 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `optifine/etf-blocks-glow` --- ### 📝 Commits (10+) - [`d27c2b4`](https://github.com/horizon-rust/horizon/commit/d27c2b4f8b01c634977cefc0c436db89eeab2c17) OptiFine emissive textures: armour stands, elytra and the dragon glow too - [`cba084f`](https://github.com/horizon-rust/horizon/commit/cba084f11064c42bdb4361990104ef59a15f149b) OptiFine emissive textures: read the overlays where armour stands draw their armour - [`69be592`](https://github.com/horizon-rust/horizon/commit/69be592cb22211dc04b355bb8ba7e5b783fdff5c) OptiFine emissive and ETF blinking: the gaps the merged PRs' last reviews found - [`7cf29b6`](https://github.com/horizon-rust/horizon/commit/7cf29b6238cdcb31a8c68f9827d5ab3975d71b22) OptiFine emissive textures: blocks glow too - [`1b896eb`](https://github.com/horizon-rust/horizon/commit/1b896eb3a6685bfc673899d18cba1865892f30c9) OptiFine emissive textures: only block sprites pair for the terrain - [`dfc2b8b`](https://github.com/horizon-rust/horizon/commit/dfc2b8b7c05ead8c61edbd529cc45d39b90c9c86) OptiFine emissive textures: a blink frame glows with its own overlay only - [`514d4b0`](https://github.com/horizon-rust/horizon/commit/514d4b012582fee6a3820f5258d6e08f2bdfa0b7) OptiFine emissive textures: test a variant blink frame's overlay in the atlas, fix the docs row - [`facacb2`](https://github.com/horizon-rust/horizon/commit/facacb2138346ed76668ee8f94e46401d1839421) OptiFine emissive textures: cutout block overlays, native mods kept to 32, safer pairing - [`2c01240`](https://github.com/horizon-rust/horizon/commit/2c012408c609c8e8ce368d9ec4672d3385c93e2f) Merge optifine/etf-followups into optifine/etf-blocks-glow - [`742df9f`](https://github.com/horizon-rust/horizon/commit/742df9fb5910a6d644435c7afef17f66655cb69e) OptiFine emissive textures: thrown tridents glow where the game draws them ### 📊 Changes **16 files changed** (+582 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/assets.rs` (+9 -0) 📝 `crates/horizon-client-render/src/entity.wgsl` (+1 -1) 📝 `crates/horizon-client-render/src/hud.rs` (+71 -13) 📝 `crates/horizon-client-render/src/native_emissive.rs` (+196 -3) 📝 `crates/horizon-client-render/src/sprites.rs` (+8 -0) 📝 `crates/horizon-client-render/src/terrain.wgsl` (+15 -5) 📝 `crates/horizon-client/src/game.rs` (+4 -4) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+37 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+13 -0) 📝 `crates/horizon-client/src/game/perspective.rs` (+40 -11) 📝 `crates/horizon-client/src/game/trident.rs` (+23 -0) 📝 `crates/horizon-client/src/mobs/data.rs` (+5 -4) 📝 `crates/horizon-client/src/mobs/render.rs` (+67 -3) 📝 `crates/horizon-optifine/src/blink.rs` (+21 -1) 📝 `crates/horizon-optifine/src/emissive.rs` (+69 -33) 📝 `docs/resource-packs.md` (+3 -0) </details> ### 📄 Description OptiFine's emissive textures also cover blocks: a `stone_e.png` beside `stone.png` holds the pixels that glow, as glowing ores, runes and lamps do in many packs. Mobs and block entities glow in Horizon now, but placed blocks didn't. With this PR, blocks glow too. **What players get:** - Every block texture the world draws that has `<name><suffix>.png` beside it (suffix from `optifine/emissive.properties`, `_e` without one) draws that overlay at full brightness over the texture, as OptiFine does. - The overlay is drawn in the same fragment as the block, on top of its lit colour, cutout as OptiFine draws SOLID textures' overlays: opaque where its alpha is at least 0.1. Light, ambient occlusion and the tint don't dim it; fog still applies. In HDR output the glowing pixels shine like vanilla's light sources. - No `_e` block textures: nothing changes. Vanilla ships none under `textures/block/`. **How:** Horizon already has this overlay path for native mods' `emissive/` textures. A table of base-layer and overlay-layer pairs sits in the terrain shader's globals, and `solid_finish` mixes the overlay in. - `native_emissive::load_optifine` runs at pack load, after the block models' sprites are in. For each loaded `block/` sprite with an overlay file beside it, it loads the overlay into the sprite array and pairs the two by name. - `RenderAssets.emissive` keeps the pairs. Each frame, `native_emissive::table` builds the shader's table: native mods' pairs first (still at most 32, as their API documents), then the OptiFine pairs (at most 96, so the 32 native pairs always fit), flagged cutout in the overlay layer's high bit, one per base layer, sorted by base layer. - The terrain shader's per-vertex search stops at the first larger base layer, so most vertices stop after a step or two instead of scanning the table. - The table grows from 32 to 128 pairs (`Globals`, terrain.wgsl, entity.wgsl). - An overlay that doesn't load (a broken PNG or `.mcmeta`) is skipped with a warning, not drawn as the glowing missing texture. Pairs past the cap and files over 1 MiB are logged too. - Blocks whose textures have identical pixels share one sprite layer, and the shader pairs by layer, so a shared base gets no overlay rather than glowing on every block that shares it. The pairing runs after the connected-texture tiles load, so a tile identical to a block counts as sharing too. - `horizon_optifine::emissive::suffix` is now shared with the entity overlays. **Limits:** - At most 96 block overlays (the table's 128 less native mods' 32). - No overlays on connected-texture tiles: CTM swaps the layer. - No overlays on translucent faces: the shader's translucent path has no overlay. - Items in hand and in the GUI draw from the HUD atlas, so they aren't covered. **Docs I wrote it from** (no mod source read): OptiFine's `OptiFineDoc/doc/emissive.properties` ("The emissive overlays are rendered in the same block layer as the base texture"). **Checks:** - `cargo fmt`: clean - Tests in `native_emissive`: - `optifine_overlays_pair_with_their_loaded_blocks` pairs a loaded `stone` with its `stone_e`; nothing for an overlay whose block isn't loaded, an item texture, a broken overlay file, or two blocks sharing a layer; a pack's own `_glow` suffix. - `the_table_keeps_native_pairs_first_and_flags_optifine_cutout`: a native pair beats the pack's on the same base, the pack's other pair carries the cutout flag, the table is sorted by base layer, and 40 native requests on 40 bases are cut to the first 32. - CI on my fork (`verify`): run linked in a comment once it finishes. - Not run: no live game test (no `.local/` vanilla data here), so the review-loop's live step is skipped. Stacked on #6454; this branch includes its commit until it merges. > [!NOTE] > Filed by Opus 5.5 using 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:28:40 +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#6888
No description provided.