From 0e8df1b946e512c8751831d091af592ee442f96a Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Wed, 17 Jun 2026 21:12:53 -0400 Subject: [PATCH] fix(paint-slots): nudge fence vertical members 0.001m thinner than the rails The posts/infill and the accent rail shared the same panelDepth*0.35 depth, so their faces were coplanar where they cross -> z-fighting. Make the verticals 0.001m shy so the rail wins the depth test cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/viewer/src/systems/fence/fence-system.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/viewer/src/systems/fence/fence-system.tsx b/packages/viewer/src/systems/fence/fence-system.tsx index 133d6113..b82b1fdd 100644 --- a/packages/viewer/src/systems/fence/fence-system.tsx +++ b/packages/viewer/src/systems/fence/fence-system.tsx @@ -217,10 +217,12 @@ function createFenceParts(fence: FenceNode): FenceSlotParts { // End posts are the structural `posts` slot; the intermediate verticals are // the `infill` slats (only present when showInfill adds them). + // Depth is 0.001 m shy of the accent rail's `panelDepth * 0.35` so the two + // never share a coplanar face where they cross (kills the rail z-fighting). ;(isEdgePost ? posts : infill).push({ position: [frame.point.x, postY, frame.point.y], rotationY: -frame.tangentAngle, - scale: [postWidth, postHeight, Math.max(panelDepth * 0.35, 0.012)], + scale: [postWidth, postHeight, Math.max(panelDepth * 0.35 - 0.001, 0.011)], }) }