feat(preview): fine ROI renders + density contour -- the caves look like caves

Implements Codex's own recommendation from its critique, after it settled
the owner's two observations with evidence:

  "hard walls"  -> THE RENDERER. rg (room graph) re-rendered at step 1 is
                   rounded and organic. The hard edges were 4-voxel
                   sampling drawn nearest-neighbour. Fifth time in this
                   project that an alarming result was the instrument.
  "like a maze" -> REAL AND CORRECT. lt (lattice) stays rectilinear at
                   step 1 because it IS a maze; 19 of 64 candidates use
                   that source.
  "noisy"       -> ALIASING. nr#22 speckle 7 solid / 1 air at step 4 ->
                   0 / 0 at step 1, broad shapes intact.

Built: an optional fine ROI pass at step 1, radius 64 (~1.8M cells, cap
2M), run only for the 42 coarse survivors, plus a deterministic density=0
CONTOUR rendered beside the filled view.

Both views are kept side by side on purpose. The filled view is honest
about what was sampled and carries the walkability evidence; the contour
is legible. Codex's line, and it is the right principle: anti-aliasing the
coarse image "would only cosmetically blur the evidence and could invent
geometry". Do not replace evidence with beauty.

Fine labels carry their own sample step and resolved window so a fine
image can never be mistaken for a coarse one, and a MaxCells refusal shows
in the page rather than looking like a failed render.

  fine sampling 71.1 s · rendering 0.6 s · peak grid 9.34 MB
  42 filled pairs, 42 contour pairs, 0 refusals, 424 image links, 0 missing

Codex corrected my spec twice in the critique, both sharp: a binary step-1
raster ALWAYS has one-voxel axis-aligned edges, so only persistent
LARGE-SCALE right angles prove boxy generation (my criterion would have
produced a false "it is boxy" verdict); and persistent speckle is not
necessarily a roughness modifier.

Roughness deliberately untouched -- its call to judge that only after fine
rendering exists, and it stands.

⚠️ KNOWN, next: the fine ROI is centred on (0,0), so a candidate whose
geometry sits elsewhere renders blank (candidate 003 is a flat sheet with
no surface in the ROI). FVoxelStrateMetrics already carries
LargestComponentPoint -- centre the ROI there instead.

Build clean, 25 succeeded / 0 failed, verified by me.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJiTcTSDNkKBtnNdiBtdaU
This commit is contained in:
Fr0zkaandClaude Opus 5 committed 2026-09-04 20:05:14 +02:00
1 parent 993512f0bc
commit 90c40c8d5a
7 files changed
+867 -61

No files matched your search

@@ -32,6 +32,8 @@ namespace VoxelStrateMeasurePrivate
// 1 = air, 0 = solid. The polarity is deliberately explicit at the sampling site below.
TArray<uint8> Air;
// Optional exact scalar samples retained only for an explicit preview capture.
TArray<float> Density;
FORCEINLINE int32 Index(int32 X, int32 Y, int32 Z) const
{
@@ -84,6 +86,7 @@ namespace VoxelStrateMeasurePrivate
float ExplicitBoundarySealThickness,
bool bUseExplicitBounds,
const FVoxelStrateMeasureSettings& Settings,
bool bCaptureDensity,
FSampleGrid& OutGrid,
FString& OutReason)
{
@@ -356,6 +359,10 @@ namespace VoxelStrateMeasurePrivate
OutGrid.SampledMinZ = static_cast<int32>(InteriorMinZ);
OutGrid.SampledMaxZ = static_cast<int32>(InteriorMaxZ);
OutGrid.Air.SetNumUninitialized(OutGrid.CellCount);
if (bCaptureDensity)
{
OutGrid.Density.SetNumUninitialized(OutGrid.CellCount);
}
bool bSawNonFiniteDensity = false;
int32 CellIndex = 0;
@@ -375,6 +382,10 @@ namespace VoxelStrateMeasurePrivate
}
// MC convention in this codebase: negative is solid, positive is air.
if (bCaptureDensity)
{
OutGrid.Density[CellIndex] = Density;
}
OutGrid.Air[CellIndex++] = Density > 0.0f ? 1u : 0u;
}
}
@@ -408,6 +419,7 @@ namespace VoxelStrateMeasurePrivate
// Move, rather than copy, the already-built polarity grid. The caller owns this buffer
// only when it explicitly requested a capture.
Destination.Air = MoveTemp(Source.Air);
Destination.Density = MoveTemp(Source.Density);
}
void DecodeIndex(const FSampleGrid& Grid, int32 Index, int32& OutX, int32& OutY, int32& OutZ)
@@ -1237,7 +1249,7 @@ namespace VoxelStrateMeasurePrivate
if (!BuildSampleGrid(Generator, Manager, Sampler, StrateIndex,
ExplicitBottomWorldZ, ExplicitTopWorldZ,
ExplicitBoundarySealThickness, bUseExplicitBounds,
Settings, Grid, RefusalReason))
Settings, false, Grid, RefusalReason))
{
if (OutDiagnostics != nullptr)
{
@@ -1291,7 +1303,7 @@ FVoxelStrateMetrics VF_MeasureStrate(
VoxelStrateMeasurePrivate::FSampleGrid Grid;
if (!VoxelStrateMeasurePrivate::BuildSampleGrid(
&Generator, &Manager, nullptr, StrateIndex, 0, 0, 0.0f, false,
Settings, Grid, Result.RefusalReason))
Settings, OutSampleGrid != nullptr, Grid, Result.RefusalReason))
{
return Result;
}
@@ -1335,7 +1347,8 @@ FVoxelStrateMetrics VF_MeasureStrateWithSampler(
VoxelStrateMeasurePrivate::FSampleGrid Grid;
if (!VoxelStrateMeasurePrivate::BuildSampleGrid(
nullptr, nullptr, &Sampler, INDEX_NONE, StrateBottomWorldZ, StrateTopWorldZ,
BoundarySealThickness, true, Settings, Grid, Result.RefusalReason))
BoundarySealThickness, true, Settings, OutSampleGrid != nullptr,
Grid, Result.RefusalReason))
{
return Result;
}