Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

.nornir/osm-fly-flow.md

OSM-Fly flow — the ONE connected story (pick Sweden → clip → fly)

facett-demo bin osm_fly_demo + lib module osm_fly wire three pieces that used to live separately into one flow:

The flow

  1. Select — Sweden preset (FlyConfig::sweden(), from region_picker::SWEDEN_POLY). FlyConfig is generic (region name + .poly text) so another country flies the moment its polygon + data exist.
  2. Clip — osm-katana clips the planet to the polygon in-process (unless the clip is already cached). The animated facett-pop ProgressView sweeps this phase.
  3. Load + build — the clipped GeoParquet is read into the flight scene (terrain + OSM buildings extruded, roads draped, water flat). The SAME progress bar continues through load + scene-build — ONE continuous story (FlyPhase bands climb monotonically: clip 2–60 % → load 60–85 % → build 85–99 % → fly 100 %), not two disjoint bars.
  4. Fly — the existing FlightController (WASD / RF / drag-look / 1-2-3 modes).

Clip → flight seam

The clip output is nodes.parquet + ways.parquet. osm_tabs::load_from reads them into OsmGeometry { points, ways_2d, ways_3d, source } — the exact type the 2D/3D OSM tabs already ingest. FlyWorld::from_geometry then:

Render path — force the discrete GPU (the smoothness fix)

The flight paint is still a CPU perspective pass (paint_world: project → shade → depth-sort → one egui::Mesh). Those meshes are then uploaded + drawn by eframe's wgpu backend. On Loki, wgpu enumerates three Vulkan ICDs — llvmpipe (Cpu software), the AMD Raphael iGPU, and the NVIDIA RTX 5080 — and eframe's DEFAULT adapter pick repeatedly landed the flight on software/iGPU (~0.1 fps): the egui meshes were being software-rasterised, so no amount of CPU-paint speed made it smooth.

The fix: osm_fly_demo's NativeOptions now install facett_demo::gpu_select::discrete_gpu_wgpu_options() — the exact same tested policy the main facett-demo binary uses (Vulkan-only backends, HighPerformance, an adapter selector that rejects the Cpu rasteriser and prefers DiscreteGpu/NVIDIA). This is a reuse, not a fork (L5): one gpu_select module, two binaries. At startup the chosen adapter is logged (facett-demo GPU: selected NVIDIA GeForce RTX 5080 [DiscreteGpu/Vulkan]) and nvidia-smi --query-gpu=utilization.gpu rises while on the flight view.

A true GPU flight renderer (GPU scattering-LUT precompute, CDLOD terrain, GPU-compute building extrusion, out-of-core streaming) is roadmapped behind the facett-map3d-flight/wgpu feature — the seam exists but no GPU render code has landed yet (see facett-map3d-flight/.nornir/flightsim-engine-roadmap.md; only the floating origin, atmospheric-scattering model, camera rig and DEM terrain have landed, all CPU). So routing the flight paint "through the map3d-flight wgpu renderer" is not yet possible — there is nothing to route to. The coherent step this pass is to stop the existing paint being software-rasterised.

Guarded RED-when-broken by gpu_select::tests::discrete_gpu_options_are_vulkan_create_new_highperf: if the shared policy is ever weakened (GL fallback re-added, backends dropped, selector removed) BOTH binaries silently regress to llvmpipe — this test fails first, no GPU needed.

CACHE — large disk, NEVER T9

Planet source (read-only; T9 is fine to READ)

osm_fly::planet_source() probes, in order: $FACETT_PLANET → planet.osm.pbf / .osm.bz2 / planet-latest.osm.pbf under the cache root → the legacy region_picker::planet_source() locations (/home/rickard/work/planet-*.osm.bz2, /run/media/rickard/T9/planet-260427.osm.bz2). Reading a planet FROM T9 is allowed — only writing cache to T9 is forbidden.

Data placement (where to drop files)

What Where Notes
Planet source (full run) $FACETT_PLANET, or /mnt/work4t/facett-osm-cache/planet.osm.pbf Also auto-found at /run/media/rickard/T9/planet-260427.osm.bz2 (162 GB, present)
Sweden clip cache /mnt/work4t/facett-osm-cache/sweden-<hash>-geo/ Written by osm-katana; skipped on a hit
Real DEM (optional) $FACETT_HGT=/path/N59E017.hgt Else the procedural DEM

A full planet → Sweden run reads the 162 GB planet-260427.osm.bz2 on T9 and writes the Sweden clip to /mnt/work4t/facett-osm-cache/ (minutes, one-time; cached after). This is a genuinely heavy run — decoding 162 GB of bz2 — so it is NOT part of cargo test.

Honesty (no faking "planet loaded")

When planet_source() finds nothing, the flow does NOT pretend. It logs:

no planet .pbf at /mnt/work4t/facett-osm-cache/planet.osm.pbf — using embedded
Sigtuna OSM (a real slice of Sweden) + procedural DEM; drop a planet extract there
(or set $FACETT_PLANET) for the full run.

and flies the embedded Sigtuna clip (real OSM, real building footprints, inside Sweden) over the procedural DEM. FlyReport::real_clip distinguishes a real clip from the fallback; the HUD/toolbar shows clip: fresh / clip: cache HIT / clip: fallback (no planet).

Tests / green-gate

osm_fly's unit tests cover: cache root defaults to the large disk and refuses T9; is_on_t9 detection; source-hash stability + size-sensitivity; clip-dir keying; progress fractions climb monotonically (one continuous bar); and the headless smoke flow_runs_end_to_end_and_is_flyable — the whole flow with planet = None (deterministic fallback, no multi-GB clip) → loads geometry → builds a flyable world with real terrain relief → climbing gains altitude. The flow takes the planet as a parameter precisely so this test can force the fallback without triggering the 162 GB clip.