[GH-ISSUE #7139] Z-fighting on bat ear textures #3151

Closed
opened 2026-11-03 04:06:15 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @byMehd on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7139

Originally assigned to: @Joansitoh on GitHub.

Bat ear textures show visible Z-fighting in Horizon, causing flickering and rendering artifacts.

In vanilla Minecraft Java Edition, the ears render correctly without this issue.

This appears to be a graphical problem with the bat model or its overlapping textures.

Tested on:

  • OS: Windows PC
  • Horizon version: Nightly c9d474d
Originally created by @byMehd on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7139 Originally assigned to: @Joansitoh on GitHub. Bat ear textures show visible Z-fighting in Horizon, causing flickering and rendering artifacts. In vanilla Minecraft Java Edition, the ears render correctly without this issue. This appears to be a graphical problem with the bat model or its overlapping textures. Tested on: - OS: Windows PC - Horizon version: Nightly `c9d474d`
Author
Owner

@Joansitoh commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

Cause: vanilla BatModel renders with RenderTypes::entityCutoutCull (BatModel.java:27), i.e. back faces are culled. The ears, wings, wing tips and feet are zero-depth boxes (BatModel.java:49-66), and ModelPart.Cube emits both the north and south quad at the same position with opposite winding. Vanilla culls whichever faces away. Horizon draws mobs through the "Entities" pipeline with cull_mode: None (gfx.rs ~3196), mob vertices carry normal [packed, -127] (gfx/entity_skin.rs ~379, entity_skin.wgsl ~110), and entity.wgsl:150 only discards back faces for the unshaded CULL_BACK encoding. Both coincident quads are drawn at equal depth, so they flicker.

Plan: add a "shaded + cull" normal.w encoding honored in entity.wgsl, a per-model cull flag set for the bat, plumbed through mobs/skin.rs into the CPU (entity_skin.rs) and GPU (entity_skin.wgsl) skin paths, keeping every other mob unchanged; unit test on the bat vertices vs. cow/cat staying at -127. Client rendering only (no server-thread impact).

<!-- gh-comment-id:6576635249 --> @Joansitoh commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. Cause: vanilla `BatModel` renders with `RenderTypes::entityCutoutCull` (BatModel.java:27), i.e. back faces are culled. The ears, wings, wing tips and feet are zero-depth boxes (BatModel.java:49-66), and `ModelPart.Cube` emits both the north and south quad at the same position with opposite winding. Vanilla culls whichever faces away. Horizon draws mobs through the "Entities" pipeline with `cull_mode: None` (`gfx.rs` ~3196), mob vertices carry normal `[packed, -127]` (`gfx/entity_skin.rs` ~379, `entity_skin.wgsl` ~110), and `entity.wgsl:150` only discards back faces for the unshaded `CULL_BACK` encoding. Both coincident quads are drawn at equal depth, so they flicker. Plan: add a "shaded + cull" normal.w encoding honored in `entity.wgsl`, a per-model cull flag set for the bat, plumbed through `mobs/skin.rs` into the CPU (`entity_skin.rs`) and GPU (`entity_skin.wgsl`) skin paths, keeping every other mob unchanged; unit test on the bat vertices vs. cow/cat staying at `-127`. Client rendering only (no server-thread impact).
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#3151
No description provided.