diag: bounded passage carve reach rejected (L93); R43 Unreal SW startup notes

Explicit carve reach R (diagnostic, default unbounded): R=2.5 m -> 1.56 cm max displacement,
106 deg max normal change; R=4 m -> 0.63 cm but 53 deg normals. Fails the bar; readiness gain
small and inconsistent (TN -5%, VS +6-7%). No world change (v214). Fast tier PASS.
R43: Unreal SW bReady 2.16 s = serial sign-edge repair (1.94 s, 10.9M corrections;
parallelSignEdgeRepair exists but off); ~0.45 s of SerializeResolvedWorld = adapter SW route search.

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-28 07:33:53 +01:00
1 parent 70c37aaab3
commit 1e111cc042
9 files changed
+545 -55

No files matched your search

+70 -24
View File
@@ -84,6 +84,20 @@ static double VF_L91PassageSourceFloorVoxels()
return Value;
}
static double VF_L93PassageCarveReachMetres()
{
static const double Value=[]
{
const char* Raw=std::getenv("VOXELFORGE_L93_PASSAGE_CARVE_REACH_METRES");
if(!Raw||!*Raw)return 0.0;
char* End=nullptr;
const double Parsed=std::strtod(Raw,&End);
return End!=Raw&&*End=='\0'&&std::isfinite(Parsed)&&Parsed>0.0
?Parsed:0.0;
}();
return Value;
}
// Standalone-only world compiler. It compiles the runtime room/tunnel/passages into
// axis-line intervals, composes rock/cave signs into packed Z-column words, then displaces
// only the conservative surface band. The copied Unreal generator remains the A/B reference.
@@ -241,14 +255,18 @@ public:
const std::array<std::int64_t,3>& minimumSubvoxels,
const std::array<std::int64_t,3>& maximumSubvoxels,
VoxelForgeCore::TileGenerationStats* profileStats=nullptr,int32 profileLod=0,
double passageSourceFloorVoxels=-1.0)
double passageSourceFloorVoxels=-1.0,
double passageCarveReachMetres=-1.0)
:shape_(&shape),minimumSubvoxels_(minimumSubvoxels),
maximumSubvoxels_(maximumSubvoxels),previous_(ActivePassageTileQueries),
profileStats_(profileStats),profileLod_(profileLod),
candidateProfiled_(profileStats!=nullptr&&shape.L90PassageCandidateProgramEnabled),
passageSourceFloorVoxels_(std::isfinite(passageSourceFloorVoxels)
&&passageSourceFloorVoxels>=0.0?passageSourceFloorVoxels
:VF_L91PassageSourceFloorVoxels())
:VF_L91PassageSourceFloorVoxels()),
passageCarveReachMetres_(std::isfinite(passageCarveReachMetres)
&&passageCarveReachMetres>=0.0?passageCarveReachMetres
:VF_L93PassageCarveReachMetres())
{
if(passageSourceFloorVoxels_>0.0)
clampCounters_=std::make_shared<FPassageSourceClampCounters>();
@@ -360,6 +378,7 @@ public:
previous_(ActivePassageTileQueries),profileLod_(source.profileLod_),
candidateProfiled_(source.candidateProfiled_),
passageSourceFloorVoxels_(source.passageSourceFloorVoxels_),
passageCarveReachMetres_(source.passageCarveReachMetres_),
clampCounters_(source.clampCounters_),ownsClampCounters_(false)
{ ActivePassageTileQueries=this; }
~FScopedPassageTileQueries()
@@ -479,6 +498,7 @@ public:
{return profileStats_;}
bool candidateCensusProfiled() const noexcept{return candidateProfiled_;}
double passageSourceFloorVoxels() const noexcept{return passageSourceFloorVoxels_;}
double passageCarveReachMetres() const noexcept{return passageCarveReachMetres_;}
void recordPassageSourceClamp(float sourceDensity) const noexcept
{
if(passageSourceFloorVoxels_<=0.0)return;
@@ -556,6 +576,7 @@ public:
int32 profileLod_=0;
bool candidateProfiled_=false;
double passageSourceFloorVoxels_=0.0;
double passageCarveReachMetres_=0.0;
mutable std::shared_ptr<FPassageSourceClampCounters> clampCounters_;
bool ownsClampCounters_=true;
mutable std::uint64_t l90Queries_=0,l90NoBrickQueries_=0;
@@ -1284,6 +1305,23 @@ public:
&&passageTileQueries->matches(*this);
auto* passageProfile=passageTileScopeMatches
?passageTileQueries->profileStats():nullptr;
const double passageCarveReachMetres=passageTileScopeMatches
?passageTileQueries->passageCarveReachMetres()
:VF_L93PassageCarveReachMetres();
const bool passageCarveReachEnabled=passageCarveReachMetres>0.0
&&std::isfinite(passageCarveReachMetres);
const double passageCarveReachQ=passageCarveReachEnabled
?passageCarveReachMetres*qPerMetre
:std::numeric_limits<double>::infinity();
const auto carveSourceReachQ=[&](float source)
{
const double sourceReach=source<0.0f
?-static_cast<double>(source)*Q+0.24*qPerMetre
:std::max(2.25*qPerMetre,-static_cast<double>(source)*Q
+0.24*qPerMetre);
return passageCarveReachEnabled
?std::min(sourceReach,passageCarveReachQ):sourceReach;
};
if(passageProfile)++passageProfile->passageComposerQueries;
const bool l90CandidateProfiled=passageTileScopeMatches
&&passageTileQueries->candidateCensusProfiled();
@@ -1335,13 +1373,10 @@ public:
&&!passageTileQueries->hasAnyMouthSupport()
&&!passageTileQueries->mayContainUpperMouthSupport())return density;
// On solid samples, the SDF carve can still move the scalar density far outside the
// physical tunnel. The per-passage test below already accounts for this tail using the
// incoming density plus the bounded relief allowance. Apply that same proof before
// entering the passage loop for points outside the scalar influence reach. Columns and
// both mouth-support paths keep their own tile envelopes and therefore disable this
// cut. Optional extra padding is only for research sweeps; zero is the exact bound.
// Invalid values fail open.
// On solid samples, the unbounded SDF carve can move density far outside the tube.
// Bound that source-dependent tail, or cap it at the explicit carve reach. Whole-tile
// rejection is limited to tiles with no route, column, or mouth feature, so the separate
// support and landing paths keep their existing envelopes. Invalid values fail open.
static const double PassageBoundPaddingVoxels=[]
{
constexpr double DefaultPaddingVoxels=0.0;
@@ -1358,7 +1393,9 @@ public:
&&std::isfinite(PassageBoundPaddingVoxels)
&&!passageTileQueries->hasColumnZOverlap()
&&!passageTileQueries->hasAnyMouthSupport()
&&!passageTileQueries->mayContainUpperMouthSupport())
&&!passageTileQueries->mayContainUpperMouthSupport()
&&(!passageCarveReachEnabled
||!passageTileQueries->hasRouteFeatureOverlap()))
{
if(passageProfile)++passageProfile->passageTileBoundChecks;
bool bAnyPassageWithinBound=false;
@@ -1388,8 +1425,11 @@ public:
(CarveHigh-Passage.controlPoints.begin())-1);
const std::ptrdiff_t CarveEnd=std::min<std::ptrdiff_t>(LowerMouthIndex-1,
(CarveLow-Passage.controlPoints.begin())+1);
const double SignedDistanceLimit=-static_cast<double>(density)*Q
+0.24*qPerMetre+ExtraPadding;
const double rawSignedDistanceLimit=-static_cast<double>(density)*Q
+0.24*qPerMetre;
const double SignedDistanceLimit=passageCarveReachEnabled
?std::min(rawSignedDistanceLimit,passageCarveReachQ)+ExtraPadding
:rawSignedDistanceLimit+ExtraPadding;
if(PassageMayAffectDensity(PassageIndex,CarveBegin,CarveEnd,
LowerMouthIndex,Constants.mouthSearchBegin,Constants.mouthSearchEnd,
Constants.lastIndex,qx,qy,qz,SignedDistanceLimit))
@@ -1686,10 +1726,7 @@ public:
const std::ptrdiff_t mouthSearchEnd=passageConstants.mouthSearchEnd;
if(l90CandidateProfiled)
{
const double signedDistanceLimit=density<0.0f
?-static_cast<double>(composed)*Q+0.24*qPerMetre
:std::max(2.25*qPerMetre,-static_cast<double>(composed)*Q
+0.24*qPerMetre);
const double signedDistanceLimit=carveSourceReachQ(composed);
const bool sourceProofAvailable=L90PassageCandidateProgramValid
&&std::isfinite(signedDistanceLimit)
&&signedDistanceLimit<=L90PassageCandidateReachMetres*qPerMetre
@@ -1704,10 +1741,12 @@ public:
}
if(density<0.0f&&tilePassageFree)
{
// A tile without this passage's route feature cannot contain its separate
// tread/support work, so the carve reach is sufficient for this query skip.
if(passageProfile)++passageProfile->passageNegativeBoundChecks;
if(!PassageMayAffectDensity(passageIndex,carveBegin,carveEnd,
lowerMouthIndex,mouthSearchBegin,mouthSearchEnd,lastIndex,qx,qy,qz,
-static_cast<double>(composed)*Q+0.24*qPerMetre))
carveSourceReachQ(composed)))
{
if(passageProfile)++passageProfile->passageNegativeBoundRejects;
continue;
@@ -1726,8 +1765,7 @@ public:
if(passageProfile)++passageProfile->passagePositiveBoundChecks;
if(!PassageMayAffectDensity(passageIndex,carveBegin,carveEnd,
lowerMouthIndex,mouthSearchBegin,mouthSearchEnd,lastIndex,qx,qy,qz,
std::max(2.25*qPerMetre,-static_cast<double>(composed)*Q
+0.24*qPerMetre)))
carveSourceReachQ(composed)))
{
if(passageProfile)++passageProfile->passagePositiveBoundRejects;
continue;
@@ -1863,10 +1901,7 @@ public:
considerCarveSegment(static_cast<std::size_t>(index),3);
}
if(!std::isfinite(bestSignedDistance))continue;
const double l90SignedDistanceLimit=density<0.0f
?-static_cast<double>(composed)*Q+0.24*qPerMetre
:std::max(2.25*qPerMetre,-static_cast<double>(composed)*Q
+0.24*qPerMetre);
const double l90SignedDistanceLimit=carveSourceReachQ(composed);
if(l90CandidateProfiled&&bestSignedDistance<=l90SignedDistanceLimit
&&l90SignedDistanceLimit<=L90PassageCandidateReachMetres*qPerMetre)
passageTileQueries->recordL90ProofCheck(0,
@@ -2108,6 +2143,17 @@ public:
*floorAlignment*floorAlignment*floorBelowWeight*mouthWalkLaneWeight;
const float fullyCarvedDensity=std::max(composed,
static_cast<float>(-roughSignedDistance/Q));
double carveReachWeight=1.0;
if(passageCarveReachEnabled)
{
constexpr double ReachBlendWidthMetres=0.5;
const double blendWidthQ=std::min(ReachBlendWidthMetres,
passageCarveReachMetres)*qPerMetre;
const double fade=std::clamp((passageCarveReachQ-bestSignedDistance)
/std::max(1.0,blendWidthQ),0.0,1.0);
if(passageProfile)++passageProfile->passageSmoothstepEvaluations;
carveReachWeight=fade*fade*(3.0-2.0*fade);
}
static const bool bL75TraceTnPassage=[]
{
const char* Value=std::getenv("VOXELFORGE_L75_TN_BLOCK_REGRESSION");
@@ -2115,7 +2161,7 @@ public:
}();
const float passageInput=composed;
composed=std::lerp(composed,fullyCarvedDensity,
static_cast<float>(floorCarveWeight));
static_cast<float>(floorCarveWeight*carveReachWeight));
if(bL75TraceTnPassage&&X==-80.0f&&Y==-20.0f&&Z==-3218.0f
&&composed!=passageInput)
{