Map 3D: fill far-field terrain without collision from the height map #159

Manually merged
github merged 3 commits from gh-pr/159/head into gh-pr/159/base 2026-11-26 20:14:18 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 13:50 UTC · original
holdmysocks:claude/world-heightmap-3d → master · +179 −36 · 5 files · 3 commits · merged 2026-11-24 14:16 UTC

Linear: SIX-96. Follows #145 (the height map decoder, merged).

What

Map 3D's far-field terrain comes from the map bake's 8 m collision grid. Cells with no collision are drawn as sea. With a full collision export that hardly matters. With a region-only export (--bbox), though, the rest of the world became open sea.

Now, when the world pyramids are built, every such cell takes its height from the game's whole-world height map in common.rpf, where that map has land. The height is sampled bilinearly from the 9.77 m grid, and shallow coast stays under the sea plane.

  • A filled share is carried through the pyramid levels.
  • Triangles whose corners all come from the height map go into a second, untextured mesh in a plain land colour. That area has no map tile.
  • Skirts follow the same rule.
  • Empty meshes are left out.

heightmap::load_all and heightmap::best move to sixng-core, and the CLI uses them. A unit test covers bilinear sampling. If common is not indexed, the build falls back to the old behaviour.

Checked

  • Full bake: 19 cells are filled from the height map. The view is unchanged, compared side by side.
  • A bake whose collision was blanked outside a 2 × 2 km square:
    • 1,152,697 cells are filled.
    • The pyramid build takes 1.1 to 1.4 s, the same as before.
    • Map 3D shows the hills, coast and inland areas around the square instead of sea.
  • Some automated screenshot runs on this machine stalled (the UI stopped redrawing). Two things show the stall is not caused by this change:
    • It happened without the height map too: with no game folder, and with the original heights file.
    • Another GPU-heavy program was running at the same time.
**@⁠holdmysocks** on GitHub · 2026-11-24 13:50 UTC · [original](https://github.com/holdmysocks/SixNG/pull/159) `holdmysocks:claude/world-heightmap-3d` → `master` · +179 −36 · 5 files · 3 commits · merged 2026-11-24 14:16 UTC Linear: SIX-96. Follows #145 (the height map decoder, merged). ## What Map 3D's far-field terrain comes from the map bake's 8 m collision grid. Cells with no collision are drawn as sea. With a full collision export that hardly matters. With a region-only export (`--bbox`), though, the rest of the world became open sea. Now, when the world pyramids are built, every such cell takes its height from the game's whole-world height map in `common.rpf`, where that map has land. The height is sampled bilinearly from the 9.77 m grid, and shallow coast stays under the sea plane. - A filled share is carried through the pyramid levels. - Triangles whose corners all come from the height map go into a second, untextured mesh in a plain land colour. That area has no map tile. - Skirts follow the same rule. - Empty meshes are left out. `heightmap::load_all` and `heightmap::best` move to `sixng-core`, and the CLI uses them. A unit test covers bilinear sampling. If `common` is not indexed, the build falls back to the old behaviour. ## Checked - Full bake: 19 cells are filled from the height map. The view is unchanged, compared side by side. - A bake whose collision was blanked outside a 2 × 2 km square: - 1,152,697 cells are filled. - The pyramid build takes 1.1 to 1.4 s, the same as before. - Map 3D shows the hills, coast and inland areas around the square instead of sea. - Some automated screenshot runs on this machine stalled (the UI stopped redrawing). Two things show the stall is not caused by this change: - It happened without the height map too: with no game folder, and with the original heights file. - Another GPU-heavy program was running at the same time.
common.rpf holds two MHIU height maps: 2048 x 2048 u8 samples over
X -13000..7000, Y -9000..11000, Z -50..500, stored as one run per row.
The new heightmap module decodes them, and `sixng heightmap` writes a
16-bit greyscale PNG (north up), heightmap.json with the world box, metres
per pixel and height scale, and an optional hill-shaded preview. --check
compares the heights with the map bake's collision height grid.
Cells the map bake leaves as sea because they have no collision (for
example outside a --bbox collision export) take their height from the
game's whole-world height map where it has land, drawn in a plain land
colour. heightmap::load_all and best are shared with the CLI.
# Conflicts:
#	README.md
#	crates/sixng-cli/src/main.rs
#	crates/sixng-core/src/heightmap.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:14:17 +00:00
github manually merged commit 758d5c7ffc into gh-pr/159/base 2026-11-26 20:14:18 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.