[PR #7820] Entities win the depth tie with coplanar terrain (boat floor over a trapdoor) #7843

Open
opened 2026-11-03 07:25:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7820
Author: @xFedeT
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/boat-coplanar-depth


📝 Commits (1)

  • c993a28 Entities win the depth tie with coplanar terrain: the boat's floor over a trapdoor

📊 Changes

1 file changed (+12 additions, -1 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+12 -1)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally.

Fixes #5950

Asked by byMehd's agent in the issue; continues the findings of the handoff in #6456 (arithmetic parity of the model and camera matrices, which this does not touch).

Reproduced with the handoff's scene (stone platform, a row of bottom dark-oak trapdoors at z = 2, an oak boat ridden into them until it stops at z 1.3125, view yaw 30 / pitch 60): a dark jagged strip of the trapdoor shows through the hull's floor, beside the front wall.

Cause: the trapdoor's top and the boat floor's top are the same plane (y 101.1875). In vanilla an entity drawn after terrain with GREATER_THAN_OR_EQUAL wins that tie. Here terrain and entities are separate draw paths (the same thing the shadow pipeline's comment says of the block tops): their fp32 depths of one plane differ by a few dozen ulps, so the tie went either way per pixel. A constant bias on the pipeline moved it: with constant: 128 on the "Entities" pipeline (the value the entity shadows already use for the same reason), the strip is gone in the same view, floor clean. Everything else in the picture is unchanged.

What this changes: only the "Entities" pipeline gets a bias of 128 ulps toward the camera (about 1e-5 of the depth range at any distance, far below the 0.001 a model's feet stand above the ground). The other entity pipelines (static block entities, translucent, water mask...) are untouched, so a similar tie elsewhere may remain.

What this is not: vanilla has no bias, so this is a tie-breaker, not proof that the depth values match its GPU path; the handoff's other leads (matrix composition on the GPU, CameraBlockPos rounding, the quad index order) are not excluded as the reason the values differ. If a maintainer prefers to look for the exact source of the difference, this can be dropped. I checked the one scene by screenshot (horizon-ctl, offscreen); I ran no pixel comparison against vanilla.

cargo clippy -p horizon-client-render, cargo test -p horizon-client-render --lib gfx (no GPU test touches this pipeline).

🤖 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/7820 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/boat-coplanar-depth` --- ### 📝 Commits (1) - [`c993a28`](https://github.com/horizon-rust/horizon/commit/c993a28c5d6931ce807b1dc74852ad84227fd3c3) Entities win the depth tie with coplanar terrain: the boat's floor over a trapdoor ### 📊 Changes **1 file changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+12 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #5950 Asked by byMehd's agent in the issue; continues the findings of the handoff in #6456 (arithmetic parity of the model and camera matrices, which this does not touch). **Reproduced** with the handoff's scene (stone platform, a row of bottom dark-oak trapdoors at z = 2, an oak boat ridden into them until it stops at z 1.3125, view yaw 30 / pitch 60): a dark jagged strip of the trapdoor shows through the hull's floor, beside the front wall. **Cause:** the trapdoor's top and the boat floor's top are the same plane (y 101.1875). In vanilla an entity drawn after terrain with `GREATER_THAN_OR_EQUAL` wins that tie. Here terrain and entities are separate draw paths (the same thing the shadow pipeline's comment says of the block tops): their fp32 depths of one plane differ by a few dozen ulps, so the tie went either way per pixel. A constant bias on the pipeline moved it: with `constant: 128` on the "Entities" pipeline (the value the entity shadows already use for the same reason), the strip is gone in the same view, floor clean. Everything else in the picture is unchanged. **What this changes:** only the "Entities" pipeline gets a bias of 128 ulps toward the camera (about 1e-5 of the depth range at any distance, far below the 0.001 a model's feet stand above the ground). The other entity pipelines (static block entities, translucent, water mask...) are untouched, so a similar tie elsewhere may remain. **What this is not:** vanilla has no bias, so this is a tie-breaker, not proof that the depth values match its GPU path; the handoff's other leads (matrix composition on the GPU, `CameraBlockPos` rounding, the quad index order) are not excluded as the reason the values differ. If a maintainer prefers to look for the exact source of the difference, this can be dropped. I checked the one scene by screenshot (`horizon-ctl`, offscreen); I ran no pixel comparison against vanilla. `cargo clippy -p horizon-client-render`, `cargo test -p horizon-client-render --lib gfx` (no GPU test touches this pipeline). 🤖 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>
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#7843
No description provided.