Skip to content

Cheaper id-map pass, and buildings that read right from below - #47

Merged
apresmoi merged 4 commits into
mainfrom
perf/idmap-cull
Sep 11, 2026
Merged

apresmoi merged 4 commits into
mainfrom
perf/idmap-cull

Conversation

@apresmoi

Copy link
Copy Markdown
Owner

Three fixes to how @glyphcss/maps draws a city: one for speed, two for what a building actually looks like when you stand next to it.

The id-map pass skips what it can't paint. computeOcclusionIds rasterised every polygon in the scene, including the ones Polygon.hidden had already culled and the cull runs the paint loop itself skips. A hidden polygon that claims a cell is worse than a wasted cycle — it punches every other layer out of a cell nothing then fills. computeOcclusionIds 6.84 → 4.69 ms on a globe overview and 6.95 → 0.68 ms at street level, where 85% of the walls are culled; on /maps with the probe, 32.23 → 28.51 ms/frame, 31.0 → 35.0 fps.

A raised band gets an underside. glyphMapVectorMesh emitted a cap and walls and no floor, so a band standing off its own ground was a hollow shell from below: the cap is back-face culled, the far walls go with it, and you look straight through. The Berlin Fernsehturm is eight stacked render_min_height bands and seven of them were open. A raised band now gets a floor wound opposite its own cap face; a building standing on the ground still gets none, since that floor is buried.

A facade is refused on a mast. Window bays are a claim that the wall is a storey stack, and no tile schema can tell us whether it is — the live OpenFreeMap building layer carries exactly render_height, render_min_height, hide_3d and colour, so building=tower never arrives. The shape separates instead: across three real z14 city tiles every genuine building is at or under 7.8 times taller than its footprint is wide and the first mast is 8.5, so GLYPH_MAP_FACADE_MAX_SLENDERNESS is 8. Houston's towers keep their windows, the Fernsehturm loses its.

Reasoning and measurements in docs/design/maps.md and docs/design/performance.md, contracts in AGENTS.md. See the checks on this PR for pnpm test and pnpm build.

@apresmoi
apresmoi merged commit b28f0cc into main Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant