From 516625cb3e92d24da7863dd7342caf17e146e7e2 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Sat, 9 May 2026 08:46:40 -0700 Subject: [PATCH] explorer: fix halo terrain occlusion via depthTestAgainstTerrain (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the reverted PR #181 fix. The earlier attempt set `disableDepthTestDistance: Number.POSITIVE_INFINITY` on every PointPrimitive, which disables depth-test entirely — including against the globe ellipsoid. That caused back-side-of-globe primitives to bleed through the planet AND broke pickability (hover labels and click-routing went to wrong primitives), both worse than the original crescent halos it was trying to fix. Codex review of d681758 identified the correct Cesium API: scene-level `globe.depthTestAgainstTerrain = false`. This tells the globe to draw primitives over terrain (fixes crescents and disappearing dots over hills) while preserving the ellipsoid's normal back-face occlusion and pick correctness. One line, applied right after Viewer construction. No per-primitive changes; the halos from #180 stay. Verified locally: - Birmingham AL hilly view (the reported repro): full-circle halos, no crescents, dots over higher terrain visible. - World view (Africa-centered): globe occlusion intact, no back-side primitive bleed-through. Co-Authored-By: Claude Opus 4.7 (1M context) --- explorer.qmd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/explorer.qmd b/explorer.qmd index 8571bf6..768b772 100644 --- a/explorer.qmd +++ b/explorer.qmd @@ -817,6 +817,14 @@ viewer = { terrain: Cesium.Terrain.fromWorldTerrain() }); + // Surface-marker primitives (h3 clusters, sample dots) sit at altitude=0; + // World Terrain elevation otherwise occludes them, producing crescent halos + // and disappearing dots over hills (#180 regression). Disabling terrain + // depth-test draws primitives over terrain while preserving globe-ellipsoid + // occlusion (back-side primitives stay hidden) and pick correctness — unlike + // per-primitive `disableDepthTestDistance: Infinity`, which broke both. + v.scene.globe.depthTestAgainstTerrain = false; + // URL deep-link state (must be set before globalRect/once block reads it) v._globeState = { mode: 'cluster', selectedPid: null }; v._initialHash = readHash();