Cap tiles lie exactly coplanar with the cliff-block tops beneath them (the distance shimmer on island tops) — cap materials pull toward the camera (factor/units -1). Glass tunnel arches push back (+1) so the opaque rim wins the contact line; wire lattices pull forward (-1) so edges on the rim surface draw clean. Browser-verified on both tunnel variants + glass marbles, 0 console errors; 116 tests green.
- commit
- 7a7cede3250050d93f506b09210468eabcd08a17
- parent
- 13c41feb8e1643ac7a326c31d2e3d17e866cdc09
- author
- Dami <dami.etoile@gmail.com>
| M | src/ | 8 | ++++++++ |
| M | src/ | 9 | +++++++++ |
@@ -212,6 +212,14 @@ export function buildIslandInstanced(
212212 const isCap = !isBlock && pieceId.includes("ground_");213213 for (const sub of subMeshesOf(template)) {214214 const mat = sub.material.clone();215+ // Cap tiles lie EXACTLY coplanar with the cliff-block tops beneath216+ // them — polygon offset pulls the cap toward the camera so the217+ // pair never z-fights (the distance shimmer on island tops).218+ if (isCap) {219+ mat.polygonOffset = true;220+ mat.polygonOffsetFactor = -1;221+ mat.polygonOffsetUnits = -1;222+ }215223 cloned.push(mat);216224 const imesh = new THREE.InstancedMesh(217225 sub.geometry,@@ -146,6 +146,11 @@ export function applyTunnelVariants(
146146 envMapIntensity: 1.0,147147 side: THREE.DoubleSide,148148 depthWrite: false,149+ // The arch flange lies on the track rim — push the glass back so150+ // the opaque rim wins the contact line cleanly.151+ polygonOffset: true,152+ polygonOffsetFactor: 1,153+ polygonOffsetUnits: 1,149154 });150155 cloned.push(mat);151156 m.material = mat;@@ -157,6 +162,10 @@ export function applyTunnelVariants(
157162 const mat = base.clone();158163 mat.wireframe = true;159164 mat.color.multiplyScalar(0.85);165+ // Lattice edges on the rim surface: pull the wires forward.166+ mat.polygonOffset = true;167+ mat.polygonOffsetFactor = -1;168+ mat.polygonOffsetUnits = -1;160169 cloned.push(mat);161170 m.material = mat;162171 }