feat: Three.js 3D asset overlay with QuadTree LOD and Mapbox camera sync - #84
Merged
elizabetheonoja-art merged 1 commit intoJun 25, 2026
Conversation
…ync (Utility-Protocol#54) Adds an immersive 3D overlay over the Mapbox canvas for assessing vertical clearance and infrastructure density, with frustum-culled Level-of-Detail. - types/spatial.ts: Coordinate3D/AABB/BoundingSphere/FrustumPlane/LODLevel/ AssetInstance and invariants (LOD 100/300/500m, 100km region, depth 8, 20k cap → 10k batch cull, 512MB GPU budget) - utils/frustum.ts: Gribb-Hartmann plane extraction from a column-major VP matrix + conservative sphere/point tests (Three-free, worker-safe) - utils/cameraMatrix.ts: perspective/lookAt/multiply + web-mercator meters, used to build the view-projection without a WebGL context - components/map/lod/QuadTree.ts: capacity-subdividing quadtree with aggregated bounding spheres; queryFrustum returns visible assets tagged by LOD, with nearest-N batch culling past the cap - workers/frustumCull.worker.ts: owns the tree and runs the per-frame query off the render thread - hooks/useMapCameraSync.ts: reads map.transform each rAF, maps mercator center to world meters, emits camera state + VP matrix (injectable map/rAF) - components/map/lod/AssetMesh.ts: THREE.LOD factory (detail/box/sprite) + InstancedMesh; components/map/ThreeOverlay.tsx: alpha renderer overlaid with pointer-events:none, worker culling, camera sync, GPU-memory LOD degrade - shaders/assetInstancing.vert: per-instance position/yaw/scale vertex shader - adds three + @types/three - tests for frustum math, camera matrices, QuadTree LOD/cull, and camera sync
elizabetheonoja-art
approved these changes
Jun 25, 2026
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.
Three.js 3D Utility Asset Overlay with QuadTree LOD and Mapbox Camera Sync (#54)
Closes #54
What's included
src/types/spatial.tsCoordinate3D/AABB/BoundingSphere/FrustumPlane/LODLevel/AssetInstanceand invariants: LOD 100/300/500 m, 100 km region, depth 8, 20k cap → 10k batch cull, 512 MB GPU budget.src/utils/frustum.tssrc/utils/cameraMatrix.tsperspective/lookAt/multiply+ web-mercator meters; builds the view-projection without a WebGL context.src/components/map/lod/QuadTree.tsqueryFrustumreturns visible assets tagged by LOD, with nearest-N batch culling past the cap;getLODLevel.src/workers/frustumCull.worker.tssrc/hooks/useMapCameraSync.tsmap.transform(center/elevation/bearing/pitch) each rAF, maps the mercator center to world meters, emits camera state + VP matrix. Injectable map/rAF.src/components/map/lod/AssetMesh.tsTHREE.LODfactory (detail → box → impostor sprite, empty past 500 m) +InstancedMeshto collapse draw calls. GLTF is injectable (no examples-subpath coupling).src/components/map/ThreeOverlay.tsxalpha:truerenderer on apointer-events:nonecanvas over the map container; worker culling, camera sync, and a GPU-memory watchdog that degrades the LOD0 distance to 50 m over budget.src/components/map/shaders/assetInstancing.verttests/unit/*,tests/hooks/*