[PR #4081] [MERGED] Inventory preview: the player is lit as ENTITY_IN_UI, not by a guess #5405

Closed
opened 2026-11-03 05:12:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4081
Author: @xFedeT
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/inventory-preview-lighting


📝 Commits (1)

  • e4b5b0f Inventory preview: the player is lit as Lighting.Entry.ENTITY_IN_UI

📊 Changes

1 file changed (+26 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/perspective.rs (+26 -2)

📄 Description

🤖 Opened by Federico's AI agent (Claude), not by Federico himself.

Fixes #4065. Claimed with /claim (assigned to xFedeT); no other open PR touches the preview's lighting.

What and why

The player in the survival inventory and in the creative screen's survival tab was lit by a rough guess (the code said "Lighting.Entry.ENTITY_IN_UI, roughly"): 0.55 + 0.45 * N.z - ..., so a face looking at the viewer was fully bright (1.0) and a top face was the darkest (0.4), the other way round from Java Edition. That is the "lighting feels different" of the report.

Change

  • game/perspective.rs entity_in_ui_shade: the vanilla shading of the entity shader (minecraft_mix_light) with the ENTITY_IN_UI lights of com.mojang.blaze3d.platform.Lighting, (0.2, -1, 1) and (-0.2, -1, 0) normalized, power 0.6 and ambient 0.4: min(1, (max(0, L0·N) + max(0, L1·N)) * 0.6 + 0.4), with N the face's outward normal in the preview's screen space. Same values for every layer of the preview (armour, cape, elytra, held items); flames stay full bright.
face Java (and now) before
front 0.82 1.00
top 1.00 0.40
bottom 0.40 0.70
right of the viewer / left 0.48 / 0.52 0.55

Vanilla reference

Lighting.Entry.ENTITY_IN_UI, GuiEntityRenderer.renderToTexture, shaders/include/light.glsl (minecraft_mix_light).

Testing

  • New unit test the_inventory_preview_is_lit_as_entity_in_ui (the six face directions against the shader's values).
  • A screenshot of the survival inventory on a Steve skin after the change (the top of the head the brightest, the front a little darker, the sides darker still) matches how Java draws it; I have no Java screenshot of the same frame to put next to it, so the exact direction convention (which side is "right") rests on the normal's sign, which the unit test fixes.
  • pr_ready --quick (Python 3.12): Python tests, rustfmt, clippy and the Rust tests (929) pass.

🤖 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/4081 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/inventory-preview-lighting` --- ### 📝 Commits (1) - [`e4b5b0f`](https://github.com/horizon-rust/horizon/commit/e4b5b0f07faf1f702811741f21145b2ebd9ef4d9) Inventory preview: the player is lit as Lighting.Entry.ENTITY_IN_UI ### 📊 Changes **1 file changed** (+26 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/perspective.rs` (+26 -2) </details> ### 📄 Description > 🤖 Opened by Federico's AI agent (Claude), not by Federico himself. Fixes #4065. Claimed with `/claim` (assigned to xFedeT); no other open PR touches the preview's lighting. ## What and why The player in the survival inventory and in the creative screen's survival tab was lit by a rough guess (the code said "`Lighting.Entry.ENTITY_IN_UI`, roughly"): `0.55 + 0.45 * N.z - ...`, so a face looking at the viewer was fully bright (1.0) and a top face was the darkest (0.4), the other way round from Java Edition. That is the "lighting feels different" of the report. ## Change - `game/perspective.rs` `entity_in_ui_shade`: the vanilla shading of the entity shader (`minecraft_mix_light`) with the `ENTITY_IN_UI` lights of `com.mojang.blaze3d.platform.Lighting`, (0.2, -1, 1) and (-0.2, -1, 0) normalized, power 0.6 and ambient 0.4: `min(1, (max(0, L0·N) + max(0, L1·N)) * 0.6 + 0.4)`, with `N` the face's outward normal in the preview's screen space. Same values for every layer of the preview (armour, cape, elytra, held items); flames stay full bright. | face | Java (and now) | before | |---|---|---| | front | 0.82 | 1.00 | | top | 1.00 | 0.40 | | bottom | 0.40 | 0.70 | | right of the viewer / left | 0.48 / 0.52 | 0.55 | ## Vanilla reference `Lighting.Entry.ENTITY_IN_UI`, `GuiEntityRenderer.renderToTexture`, `shaders/include/light.glsl` (`minecraft_mix_light`). ## Testing - New unit test `the_inventory_preview_is_lit_as_entity_in_ui` (the six face directions against the shader's values). - A screenshot of the survival inventory on a Steve skin after the change (the top of the head the brightest, the front a little darker, the sides darker still) matches how Java draws it; I have no Java screenshot of the same frame to put next to it, so the exact direction convention (which side is "right") rests on the normal's sign, which the unit test fixes. - `pr_ready --quick` (Python 3.12): Python tests, rustfmt, clippy and the Rust tests (929) pass. 🤖 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 05:12:22 +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#5405
No description provided.