From c3a12bf7924e141518b82431452377a5b73856ac Mon Sep 17 00:00:00 2001 From: Silas Lunsford Date: Mon, 26 Oct 2026 21:11:35 -0500 Subject: [PATCH] client: retune the entity-shadow depth bias to kill its rim flicker The shadow quads lie exactly on block tops like vanilla's, but terrain and shadows are separate draws: their fp32 depth interpolations disagree by a few dozen ulps of the fragment depth, and at a constant bias of 16 ulps the rim re-rolled the fight with the block top as the camera drifted a subpixel - the visible speckle. Subpixel yaw glides at three camera pitches (70, 45, 20 down) measured ~88/~60/~26 strong flip pixels a frame with the shadow, all on the rim, none without it. A constant bias of 128 ulps covers the spread at any resolution while staying far below what the 0.001 a model's feet sit higher amounts to, so shadows never bleed onto the feet. Co-Authored-By: GLM 5.3-Flash --- crates/horizon-client/src/gfx.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index 70d882a98..22a96ffba 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -1818,19 +1818,21 @@ impl Renderer { false, ); // RenderPipelines.ENTITY_SHADOW: translucent, depth test without - // writes. The quads lie on the block tops like vanilla's, but the - // terrain under them snaps to the subpixel grid at other vertices, so - // at a slant their depths differ by up to 1/256 of a pixel's depth - // slope and whole shadows failed the test. The bias covers that and - // the rounding, and stays below the 0.001 a model's feet sit higher - // (1/27 of a pixel's slope at the 16-block shadow range in 720p). + // writes. The quads lie exactly on the block tops like vanilla's, but + // terrain and shadows are separate draw paths, so their fp32 depth + // interpolations disagree by a few dozen ulps of the fragment depth + // and the shadow's rim z-fights with the block top (speckle that + // re-rolls as the camera drifts a subpixel). A constant bias of 128 + // ulps covers that spread at any resolution while staying far below + // the 0.001 a model's feet sit higher, so shadows never bleed onto + // the feet. let shadow_blob_pipeline = entity_pipeline( "Entity shadows", None, false, wgpu::CompareFunction::GreaterEqual, wgpu::DepthBiasState { - constant: 16, + constant: 128, slope_scale: 0.015, clamp: 0.0, },