DramaticShapeVoxelMod archival mirror · read-only
5a94dfe85a7a96293beb7d9e1f1f6b0809ca07fe

keep edge-row buildings' eave overhangs across the seam

DramaticShape · 2026-07-27 · parent 0bc3d3f14d

keep edge-row buildings' eave overhangs across the seam

A body-anchored building's eave juts frontEave voxels past the map
boundary; the neighbour-body mask read that overhang as a ring scrap
and opened the roof rim into the sky from across the seam. Building
placements only scan the body, so their quads now carry an `own` flag
the edge keep-rules never touch.

Changed files

CHANGELOG.md        | 10 ++++++++++
 lib/Buildings.lua   |  7 +++++++
 lib/ChunkMesher.lua |  8 +++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

Diff

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4af8005..242e5ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -128,6 +128,16 @@
   body is the scrap the mask is for. The mesher now reads the winding and
   keeps outward faces on the body's boundary planes, on all four edges.
 
+  The roof RIM had the same problem one step further out: an edge-row
+  house's eave overhangs `frontEave` voxels PAST the boundary plane into
+  the neighbour's airspace, and those quads are neither on the plane
+  (the winding rescue) nor over the body -- the neighbour-body mask ate
+  them as ring scraps, so from across the seam the roof edge was open
+  sky at low camera angles. Building placements only ever scan the map
+  BODY, so every building quad is this map's own structure by
+  construction: they now carry an `own` flag the edge keep-rules never
+  touch.
+
 ## 1.0.3
 
 ### Added
diff --git a/lib/Buildings.lua b/lib/Buildings.lua
index 11ad190..050a312 100644
--- a/lib/Buildings.lua
+++ b/lib/Buildings.lua
@@ -669,6 +669,13 @@ function Buildings.stamp(S, map, quads, tx, ty, bw, bh)
       { q[3][1] + mx, q[3][2], q[3][3] + mz },
       { q[4][1] + mx, q[4][2], q[4][3] + mz },
       uv = q.uv, shade = q.shade,
+      -- placements only ever scan the BODY, so a building is always this
+      -- map's own structure: the mesher's edge keep-rules must not eat
+      -- the parts that poke past the boundary (an edge-row house's eave
+      -- juts frontEave voxels into the neighbour's airspace, and the
+      -- neighbour-body mask read that overhang as a ring scrap -- which
+      -- opened the roof rim into the sky from across the seam)
+      own = true,
     }
   end
 end
diff --git a/lib/ChunkMesher.lua b/lib/ChunkMesher.lua
index abd5d12..1f22c02 100644
--- a/lib/ChunkMesher.lua
+++ b/lib/ChunkMesher.lua
@@ -679,7 +679,13 @@ local function runGeometry(map, bodyOnly, masks, sink)
     local x1 = math.max(q[1][1], q[2][1], q[3][1], q[4][1])
     local z0 = math.min(q[1][3], q[2][3], q[3][3], q[4][3])
     local z1 = math.max(q[1][3], q[2][3], q[3][3], q[4][3])
-    if outwardOnEdge(q, x0, z0, x1, z1) or keepQuad(x0, z0, x1, z1) then
+    -- q.own: a body-anchored structure's own quad (a building placed by
+    -- Buildings.build, whose scan never leaves the body). Exempt from
+    -- the edge keep-rules entirely: its eave legitimately overhangs the
+    -- boundary plane into the neighbour's airspace, and no variant of
+    -- the neighbour will ever draw that geometry
+    if q.own or outwardOnEdge(q, x0, z0, x1, z1)
+       or keepQuad(x0, z0, x1, z1) then
       push({ q[1], q[2], q[3], q[4] }, quadUV(q), groundShades(q, q.shade))
     end
   end