[PR #5116] [MERGED] Draw a display's shadow, interpolated as vanilla draws it #6084

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5116
Author: @MSedgeMC
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/display-shadow


📝 Commits (1)

  • 43a17d0 Draw a display's shadow, interpolated as vanilla draws it

📊 Changes

5 files changed (+105 additions, -25 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+8 -8)
📝 crates/horizon-client/src/game/text_displays.rs (+11 -0)
📝 crates/horizon-client/src/shadows.rs (+64 -15)
📝 crates/horizon-client/src/text_display.rs (+20 -0)
📝 tools/port_map/client-003.tsv (+2 -2)

📄 Description

Fixes the DisplayRenderer.getShadowRadius and DisplayRenderer.getShadowStrength rows in the port ledger. (No issue.)

Vanilla's DisplayRenderer reads both from the display's render state through a LinearFloatInterpolator, so they interpolate across the same window as the transformation (RENDER_STATE_IDS includes both, which is why a shadow-only change also restarts the interpolation). EntityRenderer.extractShadow then applies the gates: the radius clamped to 32, and the strength faded by 1 - distanceSq/256, drawing nothing when either is zero or less — the same arithmetic Horizon already had for mobs.

Horizon parsed both fields (text_display.rs), never blended them and never read them: the shadow pass collected only mobs, dropped items and experience orbs, so a display with a radius drew nothing.

The blend now lerps both with everything else, and the gate arithmetic moved into one private function that both the mob and display casters call — same float operations, one implementation, so the two cannot drift. Text, block and item displays all register through the same remote-display type, so all three cast.

Proven: cargo test -p horizon-client --lib display → 11 passed on a build box, covering the blend at both ends of the window and the gates exactly (radius 40 with strength 0.5 halfway is (20, 0.75), at distance² 64 it clamps to (32, 0.375), at distance² 256 and at strength 0 it draws nothing), and cargo check -p horizon-client --lib --bins is clean.

Not proven: the wiring — only a game run shows the blob. The check is a text display summoned with shadow_radius above 0, then /data merged back to 0, with interpolation_duration set to watch it grow instead of snapping.

Two vanilla gates left unported on purpose, both noted in the code: EntityRenderState.isInvisible (displays cannot hold Invisibility in Horizon) and view-range culling (the pass never culled mobs either, and the strength fade is already zero past 16 blocks, which covers a view_range down to about 0.25).


🔄 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/5116 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/display-shadow` --- ### 📝 Commits (1) - [`43a17d0`](https://github.com/horizon-rust/horizon/commit/43a17d0af950d2c320cc5d07bf7a80236769a300) Draw a display's shadow, interpolated as vanilla draws it ### 📊 Changes **5 files changed** (+105 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+8 -8) 📝 `crates/horizon-client/src/game/text_displays.rs` (+11 -0) 📝 `crates/horizon-client/src/shadows.rs` (+64 -15) 📝 `crates/horizon-client/src/text_display.rs` (+20 -0) 📝 `tools/port_map/client-003.tsv` (+2 -2) </details> ### 📄 Description Fixes the `DisplayRenderer.getShadowRadius` and `DisplayRenderer.getShadowStrength` rows in the port ledger. (No issue.) Vanilla's `DisplayRenderer` reads both from the display's render state through a `LinearFloatInterpolator`, so they interpolate across the same window as the transformation (`RENDER_STATE_IDS` includes both, which is why a shadow-only change also restarts the interpolation). `EntityRenderer.extractShadow` then applies the gates: the radius clamped to 32, and the strength faded by `1 - distanceSq/256`, drawing nothing when either is zero or less — the same arithmetic Horizon already had for mobs. Horizon parsed both fields (`text_display.rs`), never blended them and never read them: the shadow pass collected only mobs, dropped items and experience orbs, so a display with a radius drew nothing. The blend now lerps both with everything else, and the gate arithmetic moved into one private function that both the mob and display casters call — same float operations, one implementation, so the two cannot drift. Text, block and item displays all register through the same remote-display type, so all three cast. **Proven:** `cargo test -p horizon-client --lib display` → 11 passed on a build box, covering the blend at both ends of the window and the gates exactly (radius 40 with strength 0.5 halfway is `(20, 0.75)`, at distance² 64 it clamps to `(32, 0.375)`, at distance² 256 and at strength 0 it draws nothing), and `cargo check -p horizon-client --lib --bins` is clean. **Not proven:** the wiring — only a game run shows the blob. The check is a text display summoned with `shadow_radius` above 0, then `/data merge`d back to 0, with `interpolation_duration` set to watch it grow instead of snapping. Two vanilla gates left unported on purpose, both noted in the code: `EntityRenderState.isInvisible` (displays cannot hold Invisibility in Horizon) and view-range culling (the pass never culled mobs either, and the strength fade is already zero past 16 blocks, which covers a `view_range` down to about 0.25). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:31 +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#6084
No description provided.