garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/near-ground-layers-at-altitude.md

raw


topic: near-ground-layers-at-altitude triggers: [map_geometry.rs, street_furniture.rs, vegetation.rs, globe.rs, traffic.rs, tall_structures.rs, stream_ledger.rs, quality.rs, FURNITURE_BUILD_ON_M, TREES_BUILD_ON_M, near_ground, update_globe_visibility, HideInSpace, pending_meshes, upload_pending, TurbineRotor, "flying higher", altitude, residency, "browser rung", SWEEP_RATE, ClimbRate, CARTO_NO_SWEEP_HOLD, "zoom in", "zooming in", "descent", RING_RETEARS, VIEW_FIRST_CELLS, MeshTag, "fade in", "pop in", CARTO_PERF_FILM, descent-low, climb, "zoom out", "zooming out", held_for_sweep, orbit_space] updated: 2026-11-02

What a climb holds, and why it used to hold the street

Reported 2026-10-17 on a Mac: the web build "crashes when flying higher", with the halt card after both automatic reloads. The page's own error text was not captured, so the cause of that loss is not established (web-device-loss.md has what the card says now). What was measured is what the client asked of the GPU on the way up.

Method

Native client on an M5 Pro with the browser's own rung and the web's device limits: CARTO_QUALITY=browser CARTO_WEB_LIMITS=1, --shot-mode earth, --look=-55,0, over Groningen (53.2194, 6.5665), warm cache, 1600×900. gpu_resident_kb, upload_peak_kb and draws from --dump-state; the split by layer came from a throwaway census of live Mesh3d entities grouped by material type, deleted afterwards. These columns count bytes and entities and are machine-independent; no timing here is evidence.

1.5 km before1.5 km after33 km before33 km after
streamed content resident1,033 MB481 MB1,021 MB399 MB
worst single frame of uploads93–214 MB15.8–17.4 MB
meshes on screen (draws)6871701,7791,130

The upload peak varies run to run, hence ranges (three runs before, two after; the part above the 16 MB ceiling is assets that do not go through the ledger). draws counts visible mesh entities, not draw calls.

What the gigabyte was

What remains at 33 km is 3DBAG buildings (262 MB, 51 meshes) and OSM buildings (46 MB). From 15 km the LoD2.2 cells still texture the city in a capture, so they were left alone — that is a judgement about the picture, not a measurement.

Uploads: a cell was one admission

The browser rung now has a 16 MB per-frame ceiling (Budget::browser), and on its own that held at 1.5 km — but street level still put 173 MB in a frame. map_geometry priced a finished cell as one item, and stream_ledger always passes a frame's first item whole; at 40 m a cell (flat ground refined to the terrain, furniture, trees) is ~170 MB. Cells now land with their meshes on reserved handles and the data goes in piece by piece as the ledger admits it (MapSurfaces::upload_pending); the next cell lands only when the queue is empty, and a cell counts as complete ground — hiding the basemap under it — only once its last mesh is in. At 40 m: worst frame 173 MB → 26.9 MB (the rest of the frame is assets that do not go through the ledger), settle 10.1 s → 16.6 s. Without a ceiling the queue drains in the frame the cell landed, as before.

Street level is still 1.65 GB resident on the browser rung, against its 700 MB resident_bytes_target — load_control cannot narrow map_geometry below its radius of 1, and furniture is about a third of it. That is the next place to look, not a solved problem.

A zoom holds the ring until it slows (2026-10-20)

A descent from 40 km crosses all three bands, and each retear re-ran every cell's job — road cut and all — while the orphans of the band before kept running: a job past its download is never interrupted, so the cells that replaced them queued behind work whose result would be thrown away. None of it could land before the camera was past the band that asked for it.

Now, while the altitude changes faster than SWEEP_RATE (0.3 e-folds a second, about ×1.35/s; a smoothed rate, ClimbRate), the ring keeps the detail it has and starts no cells, and a torn-down job stops at its next stage boundary (torn() in the surface worker). A slow zoom still gains detail band by band. A one-frame jump of more than ×2 is a teleport, not a zoom, and is not held.

Measured with cargo perf --only descent on deck-1 (web-release, 1280×800, warm cache, Groningen 40 km → 150 m in 8 s; CARTO_NO_SWEEP_HOLD=1 is the before, from the same binary), two runs each:

beforeafter
ground ring retears during the zoom3 (27 cells)0
everything quiet, seconds after arrival50.9 / 51.025.1 / 27.5
worker time after arrival212 / 211 s87 / 97 s
worst frame during the zoom185 / 202 ms83 / 93 ms

At arrival and at +5 s the two look the same — basemap image, LoD2.2 shells (already in before the camera arrived, in both), trees; what moved is when the street surface lands. The one retear left is at arrival, of the cells built at the zoom's starting altitude.

The ground in view first (2026-10-21)

The nine cells landed together because they were built together: each cell's road cut already spreads over every core, so nine at once share the machine and the one under the view finishes with the eight around it. The cells within VIEW_FIRST_CELLS (0.25 of a cell, ~370 m) of the ring's centre — in Earth mode the point the view is aimed at — are now asked for alone, the rest once they have landed. Same Deck setup as above, ground in view complete after arrival: 16.4 / 26.3 s → 8.8 / 7.8 s; the whole ring unchanged at ~27 s (CARTO_NO_VIEW_FIRST=1).

A fade-in for arriving cells: built, filmed, removed (2026-10-21)

A cell drawn with its own copies of its materials, compiled as a screen-door variant of ground_detail.wesl and dithered in over half a second, then swapped back to the ordinary materials. It worked, and it could not be seen: filmed side by side on the Deck (cargo perf --only descent-low with CARTO_PERF_FILM=15, over the Grote Markt at 40 m), the basemap of the square is already the brick of the paving that replaces it. From 150 m the whole arrival moves the picture by 1.1 % (mean absolute difference). What visibly pops at arrival is the walkers, the street names and the furniture, none of them part of the ground's sheets. It was removed rather than kept for a change nobody can see. Two traps it found, both silent and both still true:

If arrival needs softening, the place is the objects that pop — labels, walkers, furniture — not the ground.

Above the flat ground's band the cuts were thrown away (2026-10-21)

Above FLAT_GROUND_OFF_M every flat sheet is dropped before the drape, but the cell job still built the paving and crop meshes and cut them, the landuse fills and the roads into each other and closed the gap fill — 3.5–4.5 s of worker time per cell on the Deck, for nothing. Those steps now run only when the flat ground is wanted; the roads are still tessellated, because the bridges, their approaches and the road mask come out of them (and the road tessellation itself turned out cheap — the cost was the cuts). cargo perf --only city (3 km) on mac-1, web-release, two runs each: load 10.1 / 10.5 s → 6.1 / 6.4 s, worker time 24–25 s → 7–8 s; the settled picture matched to within the moving traffic (mean absolute difference 6e-6).

The hold goes one way: a climb drops what it leaves (2026-11-02)

The hold above was argued for descents, and it held on a climb too: the street-level ring stayed resident and drawn until the zoom slowed — at 245–450 km on the climb below. Now a sweep may switch a band off but never on (DetailWants::held_for_sweep); dropping costs a retear and no build, since nothing is dispatched while sweeping and the basemap image stands in.

Measured with cargo perf --only climb (150 m → 200 km in 10 s over Groningen) on mac-2 (M5 Pro VM, debug + perf, 640×360, desktop rung), three runs each, the before from the same tree with the hold put back:

beforeafter
street ring dropped at245–450 km500 m and 2.5 km
mesh resident at the end of the zoom1,099 MB341 MB
mesh resident once arrived331 MB10 MB
mean frame of the zoom, median [range]37 [31–40] ms33 [32–39] ms

The memory is the result; the frame time is inside the spread and is no evidence either way on this machine. The 341 MB left at the end of the zoom is LoD2.2 (261 MB) and OSM buildings (44 MB), held to 50 km on purpose (above).

Settled, 3–45 km is not the street. The same run's census at 3, 15 and 45 km has the ring at 12 MB in 538 entities; the ~360 MB resident there is the buildings again. What costs there is draws (528 / 1,285 / 1,704) and shadow casters (285 / 581 / 594) — the next place to look, not this ring's bands.

A climb through SPACE_ENTER_ALT changes what orbit_distance means: from the ground focus below it, from the Earth's centre above it. The first climb run wrote focus distances after the handover, which pulled the camera into the ground, which handed back to the focus — a loop from 0 to 1,900 km once a second, read by every streamer as a series of teleports. The harness adds the radius once orbit_space is set; anything else driving the zoom target from outside free_camera has to do the same.