Transmission #008: Land and Tiles Lining Up

We’d gotten the 3×3 chunks loading (Transmission #006), but the world still didn’t look right: tiles backwards or misoriented, chunks stacked vertically instead of a flat grid, and terrain elevation not matching at tile boundaries. Here’s what was going on and what we fixed.

Tiles backwards / wrong orientation

OSM map plane. The map texture and tile layout didn’t match world axes. We apply a vertical flip and a 180° Y rotation to the OSM plane so north/east on the tile align with +Z/+X in Unity, and we set the origin so the 3×3 center tile (e.g. tile 21) is the one under the player, not an off-by-one.

Terrain north/south. Terrain heightmap row order didn’t match geographic north/south. We always apply an N/S flip when using geographic data so row 0 is south and the last row is north, matching the map.

Map on terrain. The OSM texture on the terrain is pinned to the terrain’s XZ footprint via _BaseMap_ST so the map image stretches correctly with the terrain and doesn’t drift.

Chunks “stacked” instead of a 3×3 grid

Chunk positions in code were correct (different X/Z per tile, Y=0), but on screen it looked like three rows stacked on top of each other at different heights instead of a flat grid.

Camera rig rotation. The PlayerCameraRig in the scene had a 90° X rotation. That made the camera look along the ground instead of at it, so the horizontal XZ grid appeared as a vertical wall—hence “three rows at different Y.” Fix: set the camera rig’s transform rotation to (0, 0, 0). To look down at the map, pitch the camera itself, not the whole rig.

Chunk and Map rotation. We re-apply each chunk’s local position and rotation when it’s activated, and force the Map container (the child that holds the map plane and terrain) to identity rotation. That way nothing in the prefab or in Awake/Start can tilt the chunk or the map so it looks like a card standing up.

Terrain elevation not lining up at boundaries

Even with chunks in the right place, terrain height didn’t match across tile edges. One chunk’s “hill” would end at a seam and the neighbor would have a step or a different base height.

Per-chunk min/max. We were normalizing each chunk’s elevation to its own min/max. So every chunk got a 0–1 height range, but the scale (meters per unit) was different. At boundaries, the same real-world elevation produced different normalized values, so we got seams or rows at different “base” heights.

Overlap-based alignment. We now fetch a 3×3 set of elevation tiles per chunk (center tile plus one in each direction) so we have overlap with neighbors. The first chunk to finish building uses its own ref and range and registers them with the coordinator. Every other chunk uses that global ref and range for normalization. So all chunks share the same meter→height scale; at any boundary the raw elevation is continuous, so the normalized height matches and the terrain stitches.

Overlap flag was off. The chunk prefab had useRasterOverlapAlignment set to 0, so the overlap path never ran—we never fetched 3×3 or used global ref/range. We enabled it in the prefab and set the default to true in the script so new chunks use overlap alignment by default.


So: camera rig at identity so the grid isn’t viewed as a wall; chunk and Map rotation forced so nothing tilts; and one global elevation ref/range plus 3×3 overlap so terrain lines up in all directions. The 3×3 should now look like one continuous piece of land.