[PR #2812] [MERGED] Text displays: vanilla text depths and polygon offset (holograms no longer z-fight) #4632

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2812
Author: @socksprox
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/text-display-depth


📝 Commits (3)

  • c3987df Text displays: vanilla text depths and polygon offset, with a render harness
  • a287f70 Text displays: a § ending a part breaks only that part; doc back on format_translation
  • bd80ffd Merge main into this branch after the render crate split (#3186)

📊 Changes

11 files changed (+919 additions, -128 deletions)

View changed files

📝 crates/horizon-client-core/src/text.rs (+30 -25)
📝 crates/horizon-client-render/src/font.rs (+150 -1)
📝 crates/horizon-client-render/src/gfx.rs (+41 -7)
📝 crates/horizon-client-render/src/gfx/entity_batch.rs (+19 -13)
📝 crates/horizon-client-render/src/hud.rs (+66 -11)
📝 crates/horizon-client/examples/probe/main.rs (+2 -0)
➕ crates/horizon-client/examples/probe/text_display_render_fixture.rs (+70 -0)
📝 crates/horizon-client/src/game/text_displays.rs (+21 -71)
📝 crates/horizon-client/src/text_display.rs (+94 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTextDisplayRenderOracle.java (+271 -0)
➕ tools/test_text_display_render_parity.py (+155 -0)

📄 Description

🤖 Opened by socksprox's AI agent (Claude Code), not by socksprox themself.

What players saw

Server holograms (text displays, e.g. GommeHD's lobby signs) looked speckled: the background, the text's shadow and the glyphs were drawn in one plane and z-fought, worse with distance and the display's scale.

Fix

  • Depths as vanilla (hud.rs, HudBatch::text_styled_world): in the world the shadow is at z 0, the glyph 0.03 in front (Font.SHADOW_DEPTH), a bold copy +0.001, underline/strikethrough +0.01, the background −0.01 (Font.prepareBackground), all through the display's own scale(-0.025). GUI text is unchanged.
  • TEXT_POLYGON_OFFSET: text displays that are not see-through draw in their own entity material (overlay 35) with vanilla's depth bias (1, 10), so text flush against a block wins against it.
  • The text layout moved from game/text_displays.rs into the lib (text_display::{Lines, draw}), so the probe runs the game's code.

New harness: text_display_render

VanillaTextDisplayRenderOracle sets a text display's data, runs the real TextDisplayRenderer.submitInner into a recording collector (with the client's ClientLanguage, so getVisualOrder is the bidi one), and turns its submits into vertices as TextFeatureRenderer does, with glyphs baked from the real providers through a GPU-less stitcher. Horizon decodes the same entity data from vanilla's wire bytes. The pose and every quad (x, y, z, ARGB) in text units are compared. 4000/4000 random cases match (290k quads).

What it found and this fixes, all things holograms hit:

  • § codes across wrapped lines: Font.split is now StringSplitter.splitLines on the raw parts (Font::split_formatted), including that a line breaking inside a part keeps the style at the break, and §r resets to no style while measuring.
  • Underline/strikethrough start 1 left at the first character of each style run (one FormattedCharSequence per run), not only the line's first.
  • A glyph whose shadow colour is 0 (black at opacity 0) draws no shadow and sits at z 0.

Tried in game on a server with the fixed build: the holograms render cleanly.

Scope is over 500 lines mostly from the new harness (oracle, probe, driver); the fix itself could be split from it if preferred.

Self-check

Check Result
Scope ⚠️ 11 files, +884 −128; 586 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 336 passed (1 min 16 s)
rustfmt ✅ (the run's failure was an import list after the rebase, formatted since; cargo fmt --all -- --check passes)
clippy ✅ (4 min 5 s)
tests: horizon-client, horizon-client-core ✅ 1367 passed (8 min 7 s)
doc tests ✅ 0 passed (36 s)
Parity --quick: 297 affected, to run in CI. Run locally on this branch: text_display_render, text_display, text_display_transform, chat_screen, hud, tab_list, block_entity_render, tooltip_display ✅; before the rebase also pack_screen, recipe_book_render ✅ (subtitle could not start here: no sounds.json in this checkout's prepared resources)
Label none: a fix

🤖 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/2812 **Author:** [@socksprox](https://github.com/socksprox) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/text-display-depth` --- ### 📝 Commits (3) - [`c3987df`](https://github.com/horizon-rust/horizon/commit/c3987df0b2817c8ccc314d69b21916703aeaf985) Text displays: vanilla text depths and polygon offset, with a render harness - [`a287f70`](https://github.com/horizon-rust/horizon/commit/a287f701e6a28b198aea6090a13df3013c69d25a) Text displays: a § ending a part breaks only that part; doc back on format_translation - [`bd80ffd`](https://github.com/horizon-rust/horizon/commit/bd80ffd540d66a4929c3e706dd708bdd4feba3da) Merge main into this branch after the render crate split (#3186) ### 📊 Changes **11 files changed** (+919 additions, -128 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/text.rs` (+30 -25) 📝 `crates/horizon-client-render/src/font.rs` (+150 -1) 📝 `crates/horizon-client-render/src/gfx.rs` (+41 -7) 📝 `crates/horizon-client-render/src/gfx/entity_batch.rs` (+19 -13) 📝 `crates/horizon-client-render/src/hud.rs` (+66 -11) 📝 `crates/horizon-client/examples/probe/main.rs` (+2 -0) ➕ `crates/horizon-client/examples/probe/text_display_render_fixture.rs` (+70 -0) 📝 `crates/horizon-client/src/game/text_displays.rs` (+21 -71) 📝 `crates/horizon-client/src/text_display.rs` (+94 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTextDisplayRenderOracle.java` (+271 -0) ➕ `tools/test_text_display_render_parity.py` (+155 -0) </details> ### 📄 Description > 🤖 Opened by socksprox's AI agent (Claude Code), not by socksprox themself. ## What players saw Server holograms (text displays, e.g. GommeHD's lobby signs) looked speckled: the background, the text's shadow and the glyphs were drawn in one plane and z-fought, worse with distance and the display's scale. ## Fix - **Depths as vanilla** (`hud.rs`, `HudBatch::text_styled_world`): in the world the shadow is at z 0, the glyph 0.03 in front (`Font.SHADOW_DEPTH`), a bold copy +0.001, underline/strikethrough +0.01, the background −0.01 (`Font.prepareBackground`), all through the display's own `scale(-0.025)`. GUI text is unchanged. - **`TEXT_POLYGON_OFFSET`**: text displays that are not see-through draw in their own entity material (overlay 35) with vanilla's depth bias (1, 10), so text flush against a block wins against it. - The text layout moved from `game/text_displays.rs` into the lib (`text_display::{Lines, draw}`), so the probe runs the game's code. ## New harness: `text_display_render` `VanillaTextDisplayRenderOracle` sets a text display's data, runs the real `TextDisplayRenderer.submitInner` into a recording collector (with the client's `ClientLanguage`, so `getVisualOrder` is the bidi one), and turns its submits into vertices as `TextFeatureRenderer` does, with glyphs baked from the real providers through a GPU-less stitcher. Horizon decodes the same entity data from vanilla's wire bytes. The pose and every quad (x, y, z, ARGB) in text units are compared. 4000/4000 random cases match (290k quads). What it found and this fixes, all things holograms hit: - `§` codes across wrapped lines: `Font.split` is now `StringSplitter.splitLines` on the raw parts (`Font::split_formatted`), including that a line breaking inside a part keeps the style at the break, and `§r` resets to no style while measuring. - Underline/strikethrough start 1 left at the first character of each style run (one `FormattedCharSequence` per run), not only the line's first. - A glyph whose shadow colour is 0 (black at opacity 0) draws no shadow and sits at z 0. Tried in game on a server with the fixed build: the holograms render cleanly. Scope is over 500 lines mostly from the new harness (oracle, probe, driver); the fix itself could be split from it if preferred. ## Self-check | Check | Result | | --- | --- | | Scope | ⚠️ 11 files, +884 −128; 586 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 336 passed (1 min 16 s) | | rustfmt | ✅ (the run's failure was an import list after the rebase, formatted since; `cargo fmt --all -- --check` passes) | | clippy | ✅ (4 min 5 s) | | tests: horizon-client, horizon-client-core | ✅ 1367 passed (8 min 7 s) | | doc tests | ✅ 0 passed (36 s) | | Parity | `--quick`: 297 affected, to run in CI. Run locally on this branch: text_display_render, text_display, text_display_transform, chat_screen, hud, tab_list, block_entity_render, tooltip_display ✅; before the rebase also pack_screen, recipe_book_render ✅ (subtitle could not start here: no `sounds.json` in this checkout's prepared resources) | | Label | none: a fix | 🤖 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:06:48 +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#4632
No description provided.