[PR #2296] [MERGED] Items: bring the enchantment glint closer to vanilla's #4182

Closed
opened 2026-11-03 04:15:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2296
Author: @masa-masa-0314
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/enchantment-glint


📝 Commits (6)

  • cf6b91a Items: draw the enchantment glint from enchanted_glint_item
  • a1761dc Lightning: move the bolt offset to vertex attribute 7
  • 1c6c6c0 Items: sample the glint from its own repeating texture
  • 43e4075 Items: animate the armour glint from enchanted_glint_armor
  • 66607c9 Items: glint enchanted armour on armour stands
  • ab083f9 Merge main into fix/enchantment-glint

📊 Changes

44 files changed (+577 additions, -92 deletions)

View changed files

📝 crates/horizon-client/src/block_entity_render.rs (+7 -0)
📝 crates/horizon-client/src/breaking.rs (+2 -0)
📝 crates/horizon-client/src/clouds.rs (+2 -0)
📝 crates/horizon-client/src/entity.wgsl (+50 -13)
📝 crates/horizon-client/src/entity_culling.rs (+2 -0)
📝 crates/horizon-client/src/fire_render.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+21 -0)
📝 crates/horizon-client/src/game/armor_stands.rs (+17 -2)
📝 crates/horizon-client/src/game/creatures.rs (+4 -0)
📝 crates/horizon-client/src/game/dragon.rs (+6 -0)
📝 crates/horizon-client/src/game/end.rs (+4 -0)
📝 crates/horizon-client/src/game/fishing.rs (+2 -0)
📝 crates/horizon-client/src/game/frames.rs (+2 -0)
📝 crates/horizon-client/src/game/item_draw.rs (+26 -0)
📝 crates/horizon-client/src/game/leads.rs (+2 -0)
📝 crates/horizon-client/src/game/maps.rs (+6 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+1 -0)
📝 crates/horizon-client/src/game/mob_blocks.rs (+2 -0)
📝 crates/horizon-client/src/game/names.rs (+1 -0)
📝 crates/horizon-client/src/game/paintings.rs (+2 -0)

...and 24 more files

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally.

What and why

Horizon invented the enchantment glint: the GUI drew procedural sine bands in screen space (item_render/gui.rs::glint_color) and the entity shader layered the same bands over held and dropped items. Vanilla 26.3 samples misc/enchanted_glint_item through GLINT_TEXTURING, so the glint looked and animated differently. This PR draws the real texture, in the inventory GUI and on items in the world, and makes the two Accessibility options Glint Speed and Glint Strength work (they were visible-but-disabled placeholders before; their sliders now persist to options.txt and drive the effect).

Details:

  • ItemQuad.foil_uv keeps the model UV the glint samples (vanilla UV0); the new item_render::Glint maps it through the 26.3 setupGlintTexturing transform (translation(-o0, o1) * rotateZ(PI/18) * scale, offsets from millis % 110000 / % 30000). WorldSink gives foil quads overlay 7 and per-corner glint UVs; gui/depth.rs interpolates them through face splitting. Like vanilla's GlintSampler, the glint binds as its own 128x128 texture with a repeat, linear, mip-free sampler (the texture's mcmeta: clamp false, blur true) in the HUD and entity pipelines, so the repeating pattern renders per pixel rather than interpolated between four folded vertex UVs.
  • The GUI glint is a separate additive HUD pass masked by the item's texture alpha, following item.fsh's ALPHA_CUTOUT 0.1 and GLINT path (color.rgb += glintColor.rgb * glintColor.rgb).
  • entity.wgsl samples the glint at overlay 7/8 with the same additive rule; Frame.glint_alpha feeds the entity shader from the option every frame. Previously the world glint strength would have ignored the option whenever no GUI item was drawn that frame.
  • GUI items use GLINT_TEXTURING's scale 8.0; world items use ENTITY_GLINT_TEXTURING's scale 0.5 (TextureTransform, 26.3).
  • Enchanted armour on living entities and armour stands now keeps its animated glint: armour layers carry overlay 13 (mobs/render.rs's ARMOR_GLINT) and their model UV, and entity.wgsl applies vanilla's ARMOR_ENTITY_GLINT_TEXTURING (scale 0.16) over misc/enchanted_glint_armor, as ARMOR_CUTOUT_NO_CULL_GLINT does. Frame.glint_ticks carries the shared scroll clock in globals.time.w. Armour stands follow ItemStack.hasFoil() (the glint override component, then the item default, then ItemStack.isEnchanted), and their trim layer glints too.

Vanilla reference

  • assets/minecraft/shaders/core/item.vsh / item.fsh (GLINT / GLINT_SPECIAL defines, ALPHA_CUTOUT)
  • assets/minecraft/shaders/core/entity.vsh / entity.fsh (GLINT over UV0)
  • net.minecraft.client.renderer.rendertype.TextureTransform.setupGlintTexturing (decompiled 26.3: Util.getMillis() * glintSpeed * 8.0, % 110000 / % 30000, rotateZ(PI/18), scale 8.0 / 0.5 per transform)
  • assets/minecraft/textures/misc/enchanted_glint_item.png
  • assets/minecraft/textures/misc/enchanted_glint_armor.png, TextureTransform.ARMOR_ENTITY_GLINT_TEXTURING (scale 0.16)
  • RenderTypes.ARMOR_CUTOUT_NO_CULL_GLINT / BlendFunction.GLINT (the squared source colour)

One known deviation: vanilla's GLINT_SPECIAL (item.vsh, FoilType.SPECIAL) samples UV3 for GUI special models; Horizon special models reuse their model UV (which matches vanilla's entity path, entity.vsh UV0). The common inventory/held-item case is standard quads and follows vanilla exactly.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on DESKTOP-3050AHP, against upstream/main at f9b2f949e, 2 min 57 s)

Check Result
Scope ⚠️ 44 files, +572 −88; 653 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (13 s)
clippy ✅ (32 s)
tests: horizon-client ❌ 1176 passed, 2 failed (1 min 59 s)
doc tests ✅ 0 passed (9 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): 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)

The PR is over 500 lines because it replaces one invented effect end to end: the GUI pass, the item path, the armour path (living entities and armour stands) and the entity shader share Glint, the scroll clock and the glint bindings; shipping the armour part alone would leave the entity shader's glint branch half migrated.

The two test failures are pre-existing on this Windows machine and also fail on a pristine upstream/main checkout: save::tests::session_lock_is_exclusive (the OS reports the lock file held) and crash::tests::stacks_start_at_the_panicking_frame (backtrace path format).

Screenshots

Not attached: this machine's offscreen renderer produces a blank window, so no usable capture is possible here. The change is best verified in-game by the glint texture drifting diagonally across enchanted items in the inventory and in hand, and across enchanted armour worn by a mob, a player or an armour stand, frozen at Glint Speed 0, and vanishing at Glint Strength 0.

🤖 Generated with ZCode


🔄 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/2296 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/enchantment-glint` --- ### 📝 Commits (6) - [`cf6b91a`](https://github.com/horizon-rust/horizon/commit/cf6b91a710eb52fa1b856d11da197514694eb243) Items: draw the enchantment glint from enchanted_glint_item - [`a1761dc`](https://github.com/horizon-rust/horizon/commit/a1761dcb658b8ac5401251320e3d18237067e42d) Lightning: move the bolt offset to vertex attribute 7 - [`1c6c6c0`](https://github.com/horizon-rust/horizon/commit/1c6c6c0b97ae6144bf476d76962d744c6d29a815) Items: sample the glint from its own repeating texture - [`43e4075`](https://github.com/horizon-rust/horizon/commit/43e407562fdfe02f05986b7721b638a033ad092a) Items: animate the armour glint from enchanted_glint_armor - [`66607c9`](https://github.com/horizon-rust/horizon/commit/66607c9eab9a313542e2a149446519b15d55a68f) Items: glint enchanted armour on armour stands - [`ab083f9`](https://github.com/horizon-rust/horizon/commit/ab083f9005848735edd07563999c5f1d6fefa3fd) Merge main into fix/enchantment-glint ### 📊 Changes **44 files changed** (+577 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/block_entity_render.rs` (+7 -0) 📝 `crates/horizon-client/src/breaking.rs` (+2 -0) 📝 `crates/horizon-client/src/clouds.rs` (+2 -0) 📝 `crates/horizon-client/src/entity.wgsl` (+50 -13) 📝 `crates/horizon-client/src/entity_culling.rs` (+2 -0) 📝 `crates/horizon-client/src/fire_render.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+21 -0) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+17 -2) 📝 `crates/horizon-client/src/game/creatures.rs` (+4 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+6 -0) 📝 `crates/horizon-client/src/game/end.rs` (+4 -0) 📝 `crates/horizon-client/src/game/fishing.rs` (+2 -0) 📝 `crates/horizon-client/src/game/frames.rs` (+2 -0) 📝 `crates/horizon-client/src/game/item_draw.rs` (+26 -0) 📝 `crates/horizon-client/src/game/leads.rs` (+2 -0) 📝 `crates/horizon-client/src/game/maps.rs` (+6 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+1 -0) 📝 `crates/horizon-client/src/game/mob_blocks.rs` (+2 -0) 📝 `crates/horizon-client/src/game/names.rs` (+1 -0) 📝 `crates/horizon-client/src/game/paintings.rs` (+2 -0) _...and 24 more files_ </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why Horizon invented the enchantment glint: the GUI drew procedural sine bands in screen space (`item_render/gui.rs::glint_color`) and the entity shader layered the same bands over held and dropped items. Vanilla 26.3 samples `misc/enchanted_glint_item` through `GLINT_TEXTURING`, so the glint looked and animated differently. This PR draws the real texture, in the inventory GUI and on items in the world, and makes the two Accessibility options **Glint Speed** and **Glint Strength** work (they were visible-but-disabled placeholders before; their sliders now persist to `options.txt` and drive the effect). Details: - `ItemQuad.foil_uv` keeps the model UV the glint samples (vanilla UV0); the new `item_render::Glint` maps it through the 26.3 `setupGlintTexturing` transform (translation(-o0, o1) * rotateZ(PI/18) * scale, offsets from `millis % 110000` / `% 30000`). `WorldSink` gives foil quads overlay 7 and per-corner glint UVs; `gui/depth.rs` interpolates them through face splitting. Like vanilla's `GlintSampler`, the glint binds as its own 128x128 texture with a repeat, linear, mip-free sampler (the texture's mcmeta: clamp false, blur true) in the HUD and entity pipelines, so the repeating pattern renders per pixel rather than interpolated between four folded vertex UVs. - The GUI glint is a separate additive HUD pass masked by the item's texture alpha, following `item.fsh`'s ALPHA_CUTOUT 0.1 and GLINT path (`color.rgb += glintColor.rgb * glintColor.rgb`). - `entity.wgsl` samples the glint at overlay 7/8 with the same additive rule; `Frame.glint_alpha` feeds the entity shader from the option every frame. Previously the world glint strength would have ignored the option whenever no GUI item was drawn that frame. - GUI items use `GLINT_TEXTURING`'s scale 8.0; world items use `ENTITY_GLINT_TEXTURING`'s scale 0.5 (`TextureTransform`, 26.3). - Enchanted armour on living entities and armour stands now keeps its animated glint: armour layers carry overlay 13 (`mobs/render.rs`'s `ARMOR_GLINT`) and their model UV, and `entity.wgsl` applies vanilla's `ARMOR_ENTITY_GLINT_TEXTURING` (scale 0.16) over `misc/enchanted_glint_armor`, as `ARMOR_CUTOUT_NO_CULL_GLINT` does. `Frame.glint_ticks` carries the shared scroll clock in `globals.time.w`. Armour stands follow `ItemStack.hasFoil()` (the glint override component, then the item default, then `ItemStack.isEnchanted`), and their trim layer glints too. ## Vanilla reference - `assets/minecraft/shaders/core/item.vsh` / `item.fsh` (GLINT / GLINT_SPECIAL defines, ALPHA_CUTOUT) - `assets/minecraft/shaders/core/entity.vsh` / `entity.fsh` (GLINT over UV0) - `net.minecraft.client.renderer.rendertype.TextureTransform.setupGlintTexturing` (decompiled 26.3: `Util.getMillis() * glintSpeed * 8.0`, `% 110000` / `% 30000`, rotateZ(PI/18), scale 8.0 / 0.5 per transform) - `assets/minecraft/textures/misc/enchanted_glint_item.png` - `assets/minecraft/textures/misc/enchanted_glint_armor.png`, `TextureTransform.ARMOR_ENTITY_GLINT_TEXTURING` (scale 0.16) - `RenderTypes.ARMOR_CUTOUT_NO_CULL_GLINT` / `BlendFunction.GLINT` (the squared source colour) One known deviation: vanilla's `GLINT_SPECIAL` (`item.vsh`, FoilType.SPECIAL) samples UV3 for GUI special models; Horizon special models reuse their model UV (which matches vanilla's entity path, `entity.vsh` UV0). The common inventory/held-item case is standard quads and follows vanilla exactly. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on DESKTOP-3050AHP, against upstream/main at f9b2f949e, 2 min 57 s) | Check | Result | | --- | --- | | Scope | ⚠️ 44 files, +572 −88; 653 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (13 s) | | clippy | ✅ (32 s) | | tests: horizon-client | ❌ 1176 passed, 2 failed (1 min 59 s) | | doc tests | ✅ 0 passed (9 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): 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) | The PR is over 500 lines because it replaces one invented effect end to end: the GUI pass, the item path, the armour path (living entities and armour stands) and the entity shader share `Glint`, the scroll clock and the glint bindings; shipping the armour part alone would leave the entity shader's glint branch half migrated. The two test failures are pre-existing on this Windows machine and also fail on a pristine `upstream/main` checkout: `save::tests::session_lock_is_exclusive` (the OS reports the lock file held) and `crash::tests::stacks_start_at_the_panicking_frame` (backtrace path format). ## Screenshots Not attached: this machine's offscreen renderer produces a blank window, so no usable capture is possible here. The change is best verified in-game by the glint texture drifting diagonally across enchanted items in the inventory and in hand, and across enchanted armour worn by a mob, a player or an armour stand, frozen at Glint Speed 0, and vanishing at Glint Strength 0. 🤖 Generated with ZCode --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:17 +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#4182
No description provided.