Skip to content

Roads: skirts drop each road's edges into the ground, so roads don't float - #1564

Merged
transfix merged 4 commits into
masterfrom
feat/road-skirts
Nov 27, 2026
Merged

transfix merged 4 commits into
masterfrom
feat/road-skirts

Conversation

@transfix

Copy link
Copy Markdown
Owner

Joe: the terrain roads "appear to float above the ground when you look at them from the side. The sides should drape down into the ground like it is a layer of pavement".

Why they floated

A road is a ribbon of triangles lifted above the terrain so it doesn't z-fight the terrain mesh. In a generated world that lift is 0.35 m. The ground under it is sampled only at the ribbon's vertices. So from the side you saw a thin band hovering over the ground, with a dark shadow band under it.

What changes

  • New option: road_mesh_params::skirt_depth. When it's above 0, these drop in a wall to that far below the sampled ground:
    • every strip's two edges;
    • an open strip's two ends, where no junction pad covers them;
    • every junction pad's rim.
  • Look: the walls are a shade darker than the road (skirt_shade, 0.75), so a road reads as a slab of pavement set into the terrain.
  • Generated worlds: their roads use skirt_depth = 0.5.
  • Normals: the walls use the road top's up normal. A slanted normal comes back from a glb slightly different each time it's written (assimp renormalises normals on export), which broke CityBundleV2's check that a world read back writes the same bytes again. An up normal round-trips exactly.
  • Closed walls: a pad's rim joins its last point back to its first instead of repeating the first point.
  • Physics: none. The road mesh is draw-only (role_render).

Checked

  • WorldRoadMesh.ASkirtDropsTheEdgesIntoTheGround, on a straight road and a crossing:
    • every wall runs from the road's edge to 0.5 m below the ground;
    • every wall triangle stands upright and faces away from the road;
    • without a skirt, the mesh is unchanged.
  • All 11 road mesh tests and all 10 bundle tests pass.
  • Windows locally: full build clean, and the broad test filter passed 2,322 of 2,322.
  • Side-view renders of a generated city world at eye height, before and after, from arigl snapshot. These are local and weren't committed.
  • No golden image draws a generated world.

Open

About 0.35 m of wall shows above the ground, which is the lift. If that reads as a curb, the generated world's lift can come down now that the walls hide the join.

…float

A road was a ribbon lifted above the terrain (0.35 m in a generated world,
so it doesn't z-fight the terrain mesh), and from the side it floated, its
shadow a dark band under it. road_mesh_params::skirt_depth (> 0) drops every
strip's edges, an open strip's ends where no junction pad covers them, and
every pad's rim in a wall to that far below the sampled ground, a shade
darker than the road (skirt_shade), so a road reads as a layer of pavement
set into the terrain. A generated world's roads take skirt_depth 0.5.

The walls take the road top's up normal: a slanted normal comes back from a
glb a bit different each time (assimp normalises normals as it writes them),
and a world read back must write the same bytes again (CityBundleV2). A
closed wall joins its last point to its first instead of repeating it.

The road mesh is render-only, so the walls change no physics.
Test: WorldRoadMesh.ASkirtDropsTheEdgesIntoTheGround.
@transfix
transfix merged commit 467e526 into master Nov 27, 2026
30 checks passed
@transfix
transfix deleted the feat/road-skirts branch November 27, 2026 21:54
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