perf(core): FI LOD0 attribution, exact Z-inner traversal; fix a mesh gap at the passage shaft foot (L57); R26

Sampled cycle attribution of FI LOD0 field work: grid fill 83%, boundary 13%, skirts 4%; island roots,
columns and helix dominate, the column cache path is real but secondary (no thrashing). FI-only Z-inner
traversal at LOD0 (same lattice samples, exact) cuts FI whole view 5.35 -> 5.03 s and moving p50 by 12%;
global Z-inner and <=4-island culling were measured and rejected. The meshing band now includes the planned
passage support column's conservative bounds, closing a real gap where the arrival shaft meets the floor
(WorldAssemblyEvaluatorVersion 208 -> 209). fast/medium/full PASS, Clang and GCC.
Research R26 (self-checked): native lattice (maze/shaft) generator design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-25 10:47:44 +01:00
1 parent 4e64b75044
commit 1e3e04bbac
14 files changed
+777 -48

No files matched your search

@@ -1205,6 +1205,12 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const int32 SampleX=OriginVoxels.X+gx*Step;
const int32 SampleY=OriginVoxels.Y+gy*Step;
const int32 SampleZ=OriginVoxels.Z+gz*Step;
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim
||gz<0||gz>GridDim;
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
bBoundarySample
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
:VoxelForgeCore::floating_island_detail::EIslandFieldCaller::GridFill);
DensityGrid[LocalIndex] = ShapeWorldContext
?ShapeWorldContext->DensityAtLattice(SampleX,SampleY,SampleZ)
:Generator->GetDensityAtLattice(SampleX,SampleY,SampleZ,
@@ -1219,12 +1225,16 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
}
}
};
// Very coarse tiles revisit the same XY cache window across a tall Z run. Keep that
// vertical run contiguous; SampleGridPoint writes by lattice index, so output bits do
// not depend on this traversal. Finer tiles retain plane-first traversal, which has
// lower overhead when a tile spans only one room-graph region.
// Floating-island LOD0 points reuse the same island/XY column keys across vertical
// samples; large coarse tiles also revisit the same XY window across tall Z runs.
// SampleGridPoint writes by lattice index, so output bits do not depend on traversal order.
const int64 TileExtentVoxels = static_cast<int64>(Step) * CellsPerAxis;
const bool bUseVerticalCacheTraversal = TileExtentVoxels > CHUNK_SIZE * 16;
const float TileMiddleZ=static_cast<float>(OriginVoxels.Z)
+static_cast<float>(TileExtentVoxels)*0.5f;
const bool bFloatingIslandLod0=Step==1&&ShapeWorldContext
&&ShapeWorldContext->IsFloatingIslandFieldAtZ(TileMiddleZ);
const bool bUseVerticalCacheTraversal=bFloatingIslandLod0
||TileExtentVoxels>CHUNK_SIZE*16;
const FStandaloneShapeWorld* ActiveShapeWorld=ShapeWorldContext;
const bool bUseShapeWorldZBatch=ActiveShapeWorld!=nullptr
&&ActiveShapeWorld->IsAnalyticOnly()
@@ -1235,6 +1245,12 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const auto SampleShapeWorldXBatch=[&](int32 GX0,int32 BatchCount,int32 gy,int32 gz)
{
float Densities[8]{};
const bool bBoundarySample=GX0<0||GX0+BatchCount-1>GridDim
||gy<0||gy>GridDim||gz<0||gz>GridDim;
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
bBoundarySample
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
:VoxelForgeCore::floating_island_detail::EIslandFieldCaller::GridFill);
ActiveShapeWorld->DensityAtLatticeX8(OriginVoxels.X+GX0*Step,Step,
OriginVoxels.Y+gy*Step,OriginVoxels.Z+gz*Step,BatchCount,Densities);
if(OutStageTimings)
@@ -1275,6 +1291,12 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const int32 SampleX=OriginVoxels.X+gx*Step;
const int32 SampleY=OriginVoxels.Y+gy*Step;
float Densities[CHUNK_SIZE+3]{};
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim
||GzLo<0||GzHi>GridDim;
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
bBoundarySample
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
:VoxelForgeCore::floating_island_detail::EIslandFieldCaller::GridFill);
ActiveShapeWorld->DensityAtLatticeZRun(SampleX,SampleY,
OriginVoxels.Z+GzLo*Step,Step,BatchCount,Densities);
for(int32 Lane=0;Lane<BatchCount;++Lane)
@@ -1425,6 +1447,11 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const int32 SampleX=OriginVoxels.X+gx*Step;
const int32 SampleY=OriginVoxels.Y+gy*Step;
const int32 SampleZ=OriginVoxels.Z+gz*Step;
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim;
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
bBoundarySample
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
:VoxelForgeCore::floating_island_detail::EIslandFieldCaller::GridFill);
DensityGrid[LocalIndex]=ShapeWorldContext
?ShapeWorldContext->DensityAtLattice(SampleX,SampleY,SampleZ)
:Generator->GetDensityAtLattice(SampleX,SampleY,SampleZ);
@@ -2035,6 +2062,8 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const int32 CapSurfaceTriangleCount=CapTris.Num()/3;
TArray<uint8> GroundSkirtFaceMasks,CapSkirtFaceMasks;
const uint64 SkirtStageStartCycles=OutStageTimings?FPlatformTime::Cycles64():0;
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller skirtFieldCaller(
VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Skirt);
if (bGenerateSkirts && (GroundTris.Num() + CapTris.Num()) > 0)
{
const float ExtentCm = (float)(CellsPerAxis * Step) * GeometryVoxelSize;