[PR #6217] [MERGED] OptiFine emissive textures: mobs' _e overlays glow at full brightness #6722

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

📋 Pull Request Information

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

Base: main ← Head: optifine/etf-emissive


📝 Commits (10+)

  • e190856 OptiFine emissive textures: mobs' _e overlays glow at full brightness
  • 352b2d0 OptiFine emissive textures: parenthesise the test's light value
  • b1a756e OptiFine random entities: vanilla on a miss, custom-model and warden textures choose too
  • ead5f88 Merge main into optifine/etf-emissive
  • d1df8b8 Merge optifine/etf-fixes into optifine/etf-emissive
  • 12aa338 OptiFine random entities: budget every variant, one cem key, and a miss answered once a check
  • 509bf3c OptiFine emissive textures: players' armour glows too
  • 96ffa46 Merge optifine/etf-fixes into optifine/etf-emissive
  • 5161c30 OptiFine emissive textures: overlays after variants in the budget, a safer suffix, more tests
  • 587872b OptiFine random entities: a pack reload resets the miss throttle too

📊 Changes

13 files changed (+1193 additions, -126 deletions)

View changed files

📝 crates/horizon-client-render/src/hud.rs (+119 -3)
📝 crates/horizon-client/src/game/armor_stands.rs (+19 -5)
📝 crates/horizon-client/src/game/packs.rs (+10 -4)
📝 crates/horizon-client/src/game/perspective.rs (+2 -1)
📝 crates/horizon-client/src/game/random_textures.rs (+8 -6)
📝 crates/horizon-client/src/mobs/cem.rs (+1 -0)
📝 crates/horizon-client/src/mobs/data.rs (+8 -3)
📝 crates/horizon-client/src/mobs/random_textures.rs (+323 -80)
📝 crates/horizon-client/src/mobs/render.rs (+402 -16)
➕ crates/horizon-optifine/src/emissive.rs (+265 -0)
📝 crates/horizon-optifine/src/lib.rs (+4 -2)
📝 crates/horizon-optifine/src/random.rs (+13 -3)
📝 crates/horizon-optifine/src/random_textures.rs (+19 -3)

📄 Description

OptiFine packs make parts of mobs glow with emissive overlays: zombie_e.png beside zombie.png holds only the pixels that should shine, like eyes or runes. Horizon ignored them, so those mobs looked dull at night. With this PR, mobs and their layers draw their _e overlays at full brightness, the way OptiFine and Entity Texture Features do.

What players get:

  • Suffix: suffix.emissive from optifine/emissive.properties, ETF's etf/emissive.properties or textures/emissive.properties (first found wins), and _e without one, as ETF reads it.
  • Every texture with an overlay beside it glows: a mob's body and every layer (eyes, wool, saddles, armour, villager clothes, a .jem's own texture), and the armour players wear (theirs reaches the renderer as extra layers, which now carry the overlay too). Armour stands, the elytra (when it shows its own texture, not a cape) and the ender dragon, which each draw on their own, glow the same way.
  • Random variants glow with their own overlays: optifine/random/entity/zombie/zombie3_e.png over zombie3, never over zombie, as ETF's guide says. The atlas packs those overlays.
  • How it looks: OptiFine's look, which ETF's guide calls "dull emissives". The overlay is the same geometry drawn again with full sky and block light. It keeps the model's shading and the body's colour (invisibility fades it too). It gets no hurt tint and no armour glint.
  • No _e files: nothing is drawn twice. Vanilla ships no entity texture ending in _e (I checked a prepared 26.3 tree's file names), so packs without overlays look exactly as before.

How:

  • horizon_optifine::emissive::Emissive::scan reads the suffix and pairs each textures/entity/**/<name><suffix>.png with its texture, by atlas name. It also pairs each random variant with an overlay beside it, and lists those overlays for the atlas.
  • The entity atlas builds it while it packs, and packs the variants' overlays after every variant within the variant budget, so a full budget drops glows before looks. The pack reload hands it to MobData.emissive (as with random textures), so lookups are one hash per drawn texture.
  • The suffix comes from the first of the three files that sets it. A Latin-1 file reads as Java reads it, and a suffix with a path separator or .. is ignored. Known limit: ETF reads the suffix of the topmost pack. Horizon reads the packs' merged folder, which doesn't record which pack a file came from, so the folder order decides when two packs set different suffixes in different folders.
  • render_visible looks the overlay up by the sprite it actually drew (the variant or the texture) and draws the part once more. Translucent mobs mark both passes for OIT.

Seams:

  • EMF: the overlay follows whatever texture name is drawn, so a .jem's texture glows when its _e exists. Only the texture lookup changes, never the model.
  • CIT: the overlay is looked up by the armour texture actually drawn, so when CIT swaps armour textures (not wired in this tree yet) their _e overlays will apply too, as ETF's guide expects.
  • Block entities: their overlays are paired here and drawn by #6220.
  • Blocks and items: these run through the block atlas and the terrain shader, a separate PR.

Docs I wrote it from (no mod source read):

  • OptiFine's OptiFineDoc/doc/emissive.properties
  • ETF's EMISSIVE_GUIDE.md and emissive.properties: the file locations, the default suffix, variants' own overlays, dull versus bright

Checks:

  • cargo fmt: clean
  • cargo test -p horizon-optifine emissive (the one local test): 4 passed.
    • overlays beside their texture, and none without a base
    • a mod namespace
    • a variant's own overlay
    • a pack's own suffix, and where it's read (ETF's folders, a file without the key, Latin-1, a rejected \..\x)
    • nothing without overlays
  • Render tests (mobs::render::emissive_tests), each with hand-placed atlas rects:
    • a one-quad mob draws 4 vertices without _e and 8 with it. The second four are full bright, sample the overlay's sprite, and keep the first four's normals.
    • a sheep's wool layer glows with its own overlay.
    • a random variant glows with its own overlay, and not with the base texture's when it has none.
  • An atlas test: a variant's overlay packs under its name.
  • CI on my fork (verify: fmt, clippy -D warnings, cargo test --workspace): 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 #6215 (the random-texture fixes); 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/6217 **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-emissive` --- ### 📝 Commits (10+) - [`e190856`](https://github.com/horizon-rust/horizon/commit/e1908564c5cf77aeb094a1d007159a0a2a1a5633) OptiFine emissive textures: mobs' _e overlays glow at full brightness - [`352b2d0`](https://github.com/horizon-rust/horizon/commit/352b2d08a8b9c742fb9ebeb661dfd2755f72175f) OptiFine emissive textures: parenthesise the test's light value - [`b1a756e`](https://github.com/horizon-rust/horizon/commit/b1a756ee59bc7ad3ad138b32e970f6d398fc6a45) OptiFine random entities: vanilla on a miss, custom-model and warden textures choose too - [`ead5f88`](https://github.com/horizon-rust/horizon/commit/ead5f88ea36ee4972a3853cf5b6fa12cbe80dddf) Merge main into optifine/etf-emissive - [`d1df8b8`](https://github.com/horizon-rust/horizon/commit/d1df8b899626b5339f98b9ed407016a077755242) Merge optifine/etf-fixes into optifine/etf-emissive - [`12aa338`](https://github.com/horizon-rust/horizon/commit/12aa3388627b490c79cdf460fae0557cb8e73254) OptiFine random entities: budget every variant, one cem key, and a miss answered once a check - [`509bf3c`](https://github.com/horizon-rust/horizon/commit/509bf3c9e160b19350c39ff023fe42c06fdc72ec) OptiFine emissive textures: players' armour glows too - [`96ffa46`](https://github.com/horizon-rust/horizon/commit/96ffa46f2e0a735d03a6ec93cd3c425b860dd94e) Merge optifine/etf-fixes into optifine/etf-emissive - [`5161c30`](https://github.com/horizon-rust/horizon/commit/5161c303b6dda868fed2cba21375e151b3fd6ea6) OptiFine emissive textures: overlays after variants in the budget, a safer suffix, more tests - [`587872b`](https://github.com/horizon-rust/horizon/commit/587872b392191ccdb2206fda9c009cfc7a67cb00) OptiFine random entities: a pack reload resets the miss throttle too ### 📊 Changes **13 files changed** (+1193 additions, -126 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/hud.rs` (+119 -3) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+19 -5) 📝 `crates/horizon-client/src/game/packs.rs` (+10 -4) 📝 `crates/horizon-client/src/game/perspective.rs` (+2 -1) 📝 `crates/horizon-client/src/game/random_textures.rs` (+8 -6) 📝 `crates/horizon-client/src/mobs/cem.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/data.rs` (+8 -3) 📝 `crates/horizon-client/src/mobs/random_textures.rs` (+323 -80) 📝 `crates/horizon-client/src/mobs/render.rs` (+402 -16) ➕ `crates/horizon-optifine/src/emissive.rs` (+265 -0) 📝 `crates/horizon-optifine/src/lib.rs` (+4 -2) 📝 `crates/horizon-optifine/src/random.rs` (+13 -3) 📝 `crates/horizon-optifine/src/random_textures.rs` (+19 -3) </details> ### 📄 Description OptiFine packs make parts of mobs glow with emissive overlays: `zombie_e.png` beside `zombie.png` holds only the pixels that should shine, like eyes or runes. Horizon ignored them, so those mobs looked dull at night. With this PR, mobs and their layers draw their `_e` overlays at full brightness, the way OptiFine and Entity Texture Features do. **What players get:** - **Suffix:** `suffix.emissive` from `optifine/emissive.properties`, ETF's `etf/emissive.properties` or `textures/emissive.properties` (first found wins), and `_e` without one, as ETF reads it. - **Every texture with an overlay beside it** glows: a mob's body and every layer (eyes, wool, saddles, armour, villager clothes, a `.jem`'s own texture), and the armour players wear (theirs reaches the renderer as extra layers, which now carry the overlay too). Armour stands, the elytra (when it shows its own texture, not a cape) and the ender dragon, which each draw on their own, glow the same way. - **Random variants** glow with their own overlays: `optifine/random/entity/zombie/zombie3_e.png` over `zombie3`, never over `zombie`, as ETF's guide says. The atlas packs those overlays. - **How it looks:** OptiFine's look, which ETF's guide calls "dull emissives". The overlay is the same geometry drawn again with full sky and block light. It keeps the model's shading and the body's colour (invisibility fades it too). It gets no hurt tint and no armour glint. - **No `_e` files:** nothing is drawn twice. Vanilla ships no entity texture ending in `_e` (I checked a prepared 26.3 tree's file names), so packs without overlays look exactly as before. **How:** - `horizon_optifine::emissive::Emissive::scan` reads the suffix and pairs each `textures/entity/**/<name><suffix>.png` with its texture, by atlas name. It also pairs each random variant with an overlay beside it, and lists those overlays for the atlas. - The entity atlas builds it while it packs, and packs the variants' overlays after every variant within the variant budget, so a full budget drops glows before looks. The pack reload hands it to `MobData.emissive` (as with random textures), so lookups are one hash per drawn texture. - The suffix comes from the first of the three files that sets it. A Latin-1 file reads as Java reads it, and a suffix with a path separator or `..` is ignored. Known limit: ETF reads the suffix of the topmost pack. Horizon reads the packs' merged folder, which doesn't record which pack a file came from, so the folder order decides when two packs set different suffixes in different folders. - `render_visible` looks the overlay up by the sprite it actually drew (the variant or the texture) and draws the part once more. Translucent mobs mark both passes for OIT. **Seams:** - **EMF:** the overlay follows whatever texture name is drawn, so a `.jem`'s texture glows when its `_e` exists. Only the texture lookup changes, never the model. - **CIT:** the overlay is looked up by the armour texture actually drawn, so when CIT swaps armour textures (not wired in this tree yet) their `_e` overlays will apply too, as ETF's guide expects. - **Block entities:** their overlays are paired here and drawn by #6220. - **Blocks and items:** these run through the block atlas and the terrain shader, a separate PR. **Docs I wrote it from** (no mod source read): - OptiFine's `OptiFineDoc/doc/emissive.properties` - ETF's `EMISSIVE_GUIDE.md` and `emissive.properties`: the file locations, the default suffix, variants' own overlays, dull versus bright **Checks:** - `cargo fmt`: clean - `cargo test -p horizon-optifine emissive` (the one local test): 4 passed. - overlays beside their texture, and none without a base - a mod namespace - a variant's own overlay - a pack's own suffix, and where it's read (ETF's folders, a file without the key, Latin-1, a rejected `\..\x`) - nothing without overlays - Render tests (`mobs::render::emissive_tests`), each with hand-placed atlas rects: - a one-quad mob draws 4 vertices without `_e` and 8 with it. The second four are full bright, sample the overlay's sprite, and keep the first four's normals. - a sheep's wool layer glows with its own overlay. - a random variant glows with its own overlay, and not with the base texture's when it has none. - An atlas test: a variant's overlay packs under its name. - CI on my fork (`verify`: fmt, clippy `-D warnings`, `cargo test --workspace`): 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 #6215 (the random-texture fixes); 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:25:28 +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#6722
No description provided.