adityanandanx / adityanandanx/nightcall

Wayfinder map: R3F globe with zoom-driven terrain LOD

Abierto
#1 1 comentario 0 reacciones 0 asignados Ver en GitHub
wayfinder:map
Lenguaje dominante
Sin datos de lenguaje
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## Destination

A React + react-three-fiber app that draws the **whole Earth** as a WGS84 ellipsoid globe in Three.js, streaming Re:Earth Terrain quantized-mesh tiles (`https://terrain.reearth.land`), where **camera zoom drives terrain LOD** — the closer you get, the finer the terrain detail that streams in. Nothing else ships in this map: no physics, no UI panel, no other renderers.

The map is done when a browser opens the app, sees a full globe, zooms from space down to Mt Fuji (or any spot), and the terrain tessellation visibly refines with zoom — crack-free, on the ellipsoid, using this repo's own R3F terrain pipeline.

## Notes

- Domain: 3D globe rendering, quantized-mesh-1.0 terrain format, WGS84 ellipsoid math, quadtree LOD, three.js/react-three-fiber (R3F).
- Source of truth for the tiles being streamed: the **reearth-terrain** viewer at `/home/aditya/dev/reearth-terrain/viewer/index.html` and its `@navaramap/three` dependency — consult both before re-deciding anything.
- Standing decision (grilled & locked): **from-scratch R3F terrain engine**, not a wrapper around Navara. The render geometry must be ours to feed react-three-rapier later. Physics is a later map, out of scope here.
- Skills every session should consult: `codebase-design`, `domain-modeling`, `research`, `prototype`, `grilling`, `diagnosing-bugs`.
- Repo tracker: GitHub issues on `adityanandanx/nightcall` via `gh`.

## Decisions so far

- [Zoom-driven LOD: quadtree selection, crack-free](https://github.com/adityanandanx/nightcall/issues/6) — Working prototype `prototype/lod-quadtree` (commit 4dafb65): quad-locked **SSE quadtree** (Cesium level-zero error; refine while error>maxSSE) over TMS 4326 + **LRU TileCache** (byte budget + liveness stamps) + per-frame select→decode→render; **skirt** crack-mitigation (interim; production crack-free = child-from-parent edge upsampling per research #4); **RTC-center** geometry for float64 precision. Verified live: refinement monotone z2→z10 descending 15 Mm→40 km, 0 console errors. **Base branch for build.**
- [Prototype: one quantized-mesh tile rendered on the ellipsoid in R3F](https://github.com/adityanandanx/nightcall/issues/5) — Working prototype on branch `prototype/single-tile` (commit 649914b): Vite+React+R3F app fetches + decodes the Mt Fuji tile (z2/7/2), places it on the WGS84 ellipsoid via geodetic→ECEF, renders it. Verified in-browser: 4217 verts/8177 tris, correct radii, 0 console errors. Architecture confirmed workable; lazy-fetch + cache decoded meshes. Run: `npm i && npm run dev`.
- [Reference R3F/three.js globe-terrain LOD implementations to learn from](https://github.com/adityanandanx/nightcall/issues/4) — Crack-free = edge-matched child upsampled from parent mesh (+ skirts only for residual T-junctures). LOD = Cesium SSE formula + horizon-oct/occluder. Lifecycle = 3-tier queue + byte budget + liveness stamps. Steal from Cesium QuadtreePrimitive, Navara Rust core, 3DTilesRendererJS. Module split: decode→tile-cache→lod-selector→geometry-builder→drape→R3F meshes.
- [WGS84 ellipsoid math: placing geographic terrain tiles in a Three.js scene](https://github.com/adityanandanx/nightcall/issues/3) — Render in real meters; geodetic→ECEF (a=6378137, f=1/298.257223563; height on the geodetic normal). Tiling Geographic/TMS EPSG:4326 (z=0 is 2×1; y bottom-up). Globe datum = `ellipsoid` (ellipsoid=elevation+geoid; float64/RTC; max tile zoom from layer.json z0–14). NOTE: seam/skirt placement math deferred to #6.
- [Quantized-mesh-1.0 wire format: decoding terrain.reearth.land tiles](https://github.com/adityanandanx/nightcall/issues/2) — `.terrain` is a little-endian blob: 88-byte header, delta/zigzag u/v/h, high-water-mark indices, 4 edge lists, extension blocks (oct normals, watermask). Server: TMS/EPSG:4326 z0–14, 2 root tiles, extensions opt-in via `Accept` header only (URL params ignored), tiles uncompressed. Decode with a hand-rolled DataView reader; root/watermask tiles are big → lazy fetch + cache.

## Not yet specified

- Imagery/basemap draping over the terrain (EOX/OSM) — needed to make the globe legible, but deferred until terrain geometry works; graduates into a ticket after the decode→mesh→LOD frontier advances.
- Camera controls (orbit/zoom UX) — probably drei OrbitControls; exact interaction model deferred.
- Atmosphere / sky / ocean rendering at ellipsoid level — deferred.
- Scene scale & camera units (meters vs arbitrary) — deferred until the ellipsoid-placement ticket lands.

## Out of scope

- Physics (react-three-rapier) — later map.
- The full viewer UI panel (renderer/basemap switchers, location plaques) — later map.
- Cesium / MapLibre renderers — out of scope; this repo is R3F-only.
- PLATEAU buildings, demo orbit, iframe embed messaging, landing page.
- Deployment/hosting of the app.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.