explorer: bounded disableDepthTestDistance to make dots visible over terrain (closes #185)#198
Merged
rdhyee merged 1 commit intoisamplesorg:mainfrom May 10, 2026
Conversation
…terrain (closes isamplesorg#185) Cluster and sample point primitives are placed at altitude=0 (the WGS84 ellipsoid surface). With Cesium world terrain enabled, terrain mesh in hilly regions (Troodos in Cyprus, hill country around Birmingham AL, etc.) rises hundreds to thousands of meters above ellipsoid — so points at altitude=0 are physically *underground* in those regions and get depth-culled by Cesium's standard per-pixel depth test. The fix is one new property at each of the three .add() call sites: disableDepthTestDistance: POINT_DEPTH_TEST_DISTANCE // 2.0e6 = 2,000 km Bypass scope: only when the camera is closer than 2,000 km, which covers every realistic interactive altitude (point mode <120 km, res8 cluster up to ~300 km, res6 up to ~3,000 km — the upper end is technically outside the bypass but at that altitude dots are tiny anyway). Why bounded (2.0e6) and not POSITIVE_INFINITY: PR isamplesorg#181 used Infinity and caused back-side-of-globe primitive bleed-through plus broke pickability (was reverted via isamplesorg#183). A 2,000 km bound preserves globe-ellipsoid occlusion at long range while bypassing terrain occlusion at every interactive zoom. Hypothesis source: Codex review of isamplesorg#185 identified sea-level placement as the most likely root cause. Confirmed experimentally by runtime- patching the live deploy: T0 baseline (no fix) Cyprus interior: ~0 dots T1 swap to EllipsoidTerrainProvider minor improvement T2 raise primitives to height=5000m significant improvement T3 disableDepthTestDistance: 2.0e6 (this PR) significant, equivalent to T2, no back-side bleed Closes isamplesorg#185. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
Codex review round 1 — LGTM
Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #185. Three-line change at the three
viewer.h3Points.add()/viewer.samplePoints.add()sites, plus one new top-level constant.Root cause
Cluster and sample point primitives are placed at altitude=0 (the WGS84 ellipsoid surface). Cesium world terrain is enabled by default, so terrain mesh in hilly regions rises hundreds to thousands of meters above ellipsoid — sea-level primitives are physically underground there and get depth-culled by Cesium's standard per-pixel depth test.
This is why the issue manifests over the Troodos range (Cyprus) and the hill country around Birmingham, AL but not over coastal/flat regions.
Diff
Why bounded (2.0e6), not POSITIVE_INFINITY
PR #181 tried
disableDepthTestDistance: POSITIVE_INFINITYand was reverted via #183 because it caused:A bounded 2,000 km distance preserves globe-ellipsoid occlusion at long range (no back-side bleed) while bypassing terrain occlusion at every interactive zoom altitude (point mode <120 km, res8 ≤300 km, res6 ≤3,000 km).
Experimental verification
Runtime-patched the live deploy at https://isamples.org/explorer.html with the user's western Cyprus / point altitude URL. Compared four toggles:
height: 5000mdisableDepthTestDistance: 2.0e6(this PR)The dots that appear under T2/T3 are not new data — they were always loaded, just depth-culled in T0.
Local preview run of
quarto preview explorer.qmdagainst the same URL with this PR applied shows the same restored visibility.What was ruled out
The hypotheses listed in #185's body:
pixelSize: 6, scaled to ~18-48 px) disappearing entirely.heightReference—Cesium.PointPrimitivedoes not supportheightReference(onlyPointGraphics/ Entity API does). Switching the explorer to entities would be a much bigger lift than this PR.Test plan
Refs
🤖 Generated with Claude Code