wip(L6, side branch): screen-space far gate; no-op cutoff removed; cost within noise vs L4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ED33VnqepD4YY6gDAAA832
This commit is contained in:
1 parent
b21a19d561
commit
aa67bd31f5
13 files changed
+474
-615
No files matched your search
@@ -137,22 +137,17 @@ namespace StandaloneStreamBenchmark
|
||||
std::chrono::steady_clock::time_point ColdStart,bool bProfileColumnOverlap,
|
||||
int32 FarHorizonLOD8InteriorStepVoxels,bool bReportMeshCoverage=false,
|
||||
const std::filesystem::path& MeshExportPath={},float CameraYawDegrees=0.0f,
|
||||
float CameraPitchDegrees=0.0f,bool bScreenSpaceGate=false,
|
||||
bool bApplyVisualDetailCutoff=false)
|
||||
float CameraPitchDegrees=0.0f,bool bScreenSpaceGate=false)
|
||||
{
|
||||
using Clock=std::chrono::steady_clock;
|
||||
FStandaloneOwnerWorld& World=*OwnerWorld;
|
||||
const VoxelForgeCore::WorldAssemblyManifest* Assembly=CoreSnapshot.worldAssembly();
|
||||
std::array<double,9> ClosestDisplayDistances{};
|
||||
std::array<std::int64_t,9> PixelBudgetsSubvoxels{};
|
||||
std::array<std::int64_t,9> AppliedPixelBudgetsSubvoxels{};
|
||||
if(bScreenSpaceGate||bApplyVisualDetailCutoff)
|
||||
if(bScreenSpaceGate)
|
||||
{
|
||||
ClosestDisplayDistances=bScreenSpaceGate
|
||||
?StandaloneScreenSpaceGate::ClosestDisplayedDistancesMeters(
|
||||
World,CameraPositionVoxels,World.CoreVoxelSizeMicrons)
|
||||
:StandaloneScreenSpaceGate::ClipmapClosestDisplayedDistancesMeters(
|
||||
World,World.CoreVoxelSizeMicrons);
|
||||
ClosestDisplayDistances=StandaloneScreenSpaceGate::ClosestDisplayedDistancesMeters(
|
||||
World,CameraPositionVoxels,World.CoreVoxelSizeMicrons);
|
||||
const double VoxelMeters=static_cast<double>(World.CoreVoxelSizeMicrons)/1000000.0;
|
||||
for(int32 Lod=3;Lod<=World.MaxClipLevel&&Lod<9;++Lod)
|
||||
PixelBudgetsSubvoxels[static_cast<std::size_t>(Lod)]=static_cast<std::int64_t>(std::floor(
|
||||
@@ -160,67 +155,6 @@ namespace StandaloneStreamBenchmark
|
||||
*StandaloneScreenSpaceGate::OnePixelRadians/VoxelMeters
|
||||
*VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel));
|
||||
}
|
||||
AppliedPixelBudgetsSubvoxels=PixelBudgetsSubvoxels;
|
||||
if(Assembly&&(bScreenSpaceGate||bApplyVisualDetailCutoff))
|
||||
{
|
||||
for(int32 Lod=3;Lod<=World.MaxClipLevel&&Lod<9;++Lod)
|
||||
{
|
||||
const std::int32_t Cells=FMath::Max(1,World.CoarseTileCells);
|
||||
const std::int32_t Step=FMath::Max(1,(CHUNK_SIZE<<Lod)/Cells);
|
||||
VoxelForgeCore::VisualDetailCutoffV1 Probe;
|
||||
Probe.pixelBudgetSubvoxels=PixelBudgetsSubvoxels[static_cast<std::size_t>(Lod)];
|
||||
Probe.sampleStepSubvoxels=static_cast<std::int64_t>(Step)
|
||||
*VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
|
||||
std::uint64_t TermCount=0,EligibleTermCount=0,PotentialSkippedOctaves=0;
|
||||
for(const auto& Plan:Assembly->plan.strates)
|
||||
{
|
||||
const VoxelForgeCore::Heightfield2D Field(Assembly->recipe,Plan);
|
||||
for(const auto& Term:Field.visualDetailContract().terms)
|
||||
{
|
||||
++TermCount;
|
||||
const auto Result=VoxelForgeCore::FindVisualDetailTailCutoffV1(Term,Probe);
|
||||
if(Result.firstSkippedOctave==0)continue;
|
||||
++EligibleTermCount;
|
||||
PotentialSkippedOctaves+=Term.octaveCount-Result.firstSkippedOctave;
|
||||
}
|
||||
}
|
||||
std::printf("[WorldAssemblerVisualDetailCutoffPlan] lod=%d terms=%llu eligible_terms=%llu potential_skipped_octaves=%llu per_call_budget_divisor=%u sample_step_vox=%d status=%s\n",
|
||||
Lod,static_cast<unsigned long long>(TermCount),
|
||||
static_cast<unsigned long long>(EligibleTermCount),
|
||||
static_cast<unsigned long long>(PotentialSkippedOctaves),
|
||||
Probe.callBudgetDivisor,Step,
|
||||
EligibleTermCount==0?"exact-no-eligible-tail":"candidate");
|
||||
if(bApplyVisualDetailCutoff&&EligibleTermCount==0)
|
||||
AppliedPixelBudgetsSubvoxels[static_cast<std::size_t>(Lod)]=0;
|
||||
}
|
||||
}
|
||||
if(bScreenSpaceGate&&Assembly)
|
||||
{
|
||||
for(const auto& Plan:Assembly->plan.strates)
|
||||
{
|
||||
const VoxelForgeCore::Heightfield2D Field(Assembly->recipe,Plan);
|
||||
for(const auto& Term:Field.visualDetailContract().terms)
|
||||
for(std::uint32_t Octave=0;Octave<Term.octaveCount;++Octave)
|
||||
{
|
||||
const std::int64_t Wavelength=Term.baseWavelengthSubvoxels
|
||||
/static_cast<std::int64_t>(1ull<<Octave);
|
||||
const long double Amplitude=static_cast<long double>(Term.maximumDisplacementSubvoxels)
|
||||
*Term.maximumNoiseAbsQ16/65536.0L
|
||||
/static_cast<long double>(1ull<<Octave);
|
||||
std::printf("[WorldAssemblerVisualDetailTerm] stratum=%d id=%llu octave=%u wavelength_vox=%.3f max_abs_surface_vox=%.3f declared=1\n",
|
||||
Plan.strateIndex,static_cast<unsigned long long>(Term.stableId),Octave,
|
||||
static_cast<double>(Wavelength)/256.0,static_cast<double>(Amplitude));
|
||||
}
|
||||
}
|
||||
for(const auto& Island:Assembly->floatingIslands)
|
||||
{
|
||||
const VoxelForgeCore::FloatingIslandFieldV1 Field(
|
||||
Island.manifest.recipe,Island.manifest.plan);
|
||||
const auto Contract=Field.visualDetailContract();
|
||||
std::printf("[WorldAssemblerVisualDetailContract] recipe=floating-islands strate=%d declared_terms=%zu exact_path=%d\n",
|
||||
Island.strateIndex,Contract.terms.size(),Contract.terms.empty()?1:0);
|
||||
}
|
||||
}
|
||||
const bool bRoundTunnels=World.Generator->bStandaloneResearchRoundTunnels;
|
||||
const bool bEnhancedTunnelWalls=World.Generator->bStandaloneResearchEnhancedWalls;
|
||||
VoxelForgeCore::World Shape(CoreSnapshot);
|
||||
@@ -309,12 +243,7 @@ namespace StandaloneStreamBenchmark
|
||||
FStandaloneStreamingGenerator Streamer(World,WorkerCount,bHashDensity,nullptr,MaxLevel,
|
||||
bSkipUvAndColors,bSkipMaterialGroups,bSkipUV,bSkipColors,&Shape,bProfileColumnOverlap,
|
||||
FarHorizonLOD8InteriorStepVoxels);
|
||||
if(bScreenSpaceGate||bApplyVisualDetailCutoff)
|
||||
{
|
||||
Streamer.SetVisualDetailCutoffBudgets(AppliedPixelBudgetsSubvoxels,
|
||||
bApplyVisualDetailCutoff);
|
||||
Streamer.SetVisualDetailProfilingEnabled(bScreenSpaceGate);
|
||||
}
|
||||
if(bScreenSpaceGate)Streamer.SetMesherStageProfilingEnabled(true);
|
||||
const auto StreamStart=Clock::now();
|
||||
const FStandaloneStreamingUpdate Update=Streamer.StartWithDesired(Desired);
|
||||
if(Update.DesiredTiles!=static_cast<int32>(Desired.Tiles.size()))
|
||||
@@ -370,14 +299,11 @@ namespace StandaloneStreamBenchmark
|
||||
std::array<bool,9> ColumnCaptureCompleteByLOD{};
|
||||
ColumnCaptureCompleteByLOD.fill(true);
|
||||
std::array<double,9> WorkerSecondsByLOD{};
|
||||
std::array<std::array<std::uint64_t,8>,9> DetailOctaveEvaluationsByLOD{};
|
||||
std::array<std::array<std::uint64_t,8>,9> DetailOctaveEligibleByLOD{};
|
||||
std::array<std::array<std::uint64_t,8>,9> DetailOctaveSkipsByLOD{};
|
||||
std::array<std::array<double,8>,9> DetailOctaveMillisecondsByLOD{};
|
||||
std::array<std::array<double,8>,9> DetailOctaveEligibleMillisecondsByLOD{};
|
||||
std::array<double,9> ColumnEvalMsByLOD{},MarchingExclusiveMsByLOD{};
|
||||
std::array<double,9> GroundRefineExclusiveMsByLOD{},CapRefineExclusiveMsByLOD{};
|
||||
std::array<double,9> MeshAssemblyMsByLOD{};
|
||||
std::array<double,9> SkirtMsByLOD{};
|
||||
std::array<std::uint64_t,9> SkirtTrianglesByLOD{};
|
||||
std::array<std::uint64_t,9> TileCountByLOD{};
|
||||
for(const FVoxelTileKey& Tile:Desired.Tiles)
|
||||
if(Tile.Level>=0&&Tile.Level<static_cast<int32>(ExpectedTilesByLOD.size()))
|
||||
@@ -425,19 +351,8 @@ namespace StandaloneStreamBenchmark
|
||||
GroundRefineExclusiveMsByLOD[LOD]+=Tile.CoreDiagnostics.groundRefinementExclusiveMilliseconds;
|
||||
CapRefineExclusiveMsByLOD[LOD]+=Tile.CoreDiagnostics.capRefinementExclusiveMilliseconds;
|
||||
MeshAssemblyMsByLOD[LOD]+=Tile.CoreDiagnostics.meshAssemblyMilliseconds;
|
||||
for(std::size_t Octave=0;Octave<8;++Octave)
|
||||
{
|
||||
DetailOctaveEvaluationsByLOD[LOD][Octave]+=
|
||||
Tile.CoreDiagnostics.visualDetailOctaveEvaluations[Octave];
|
||||
DetailOctaveEligibleByLOD[LOD][Octave]+=
|
||||
Tile.CoreDiagnostics.visualDetailOctaveBudgetEligible[Octave];
|
||||
DetailOctaveSkipsByLOD[LOD][Octave]+=
|
||||
Tile.CoreDiagnostics.visualDetailOctaveSkips[Octave];
|
||||
DetailOctaveMillisecondsByLOD[LOD][Octave]+=
|
||||
Tile.CoreDiagnostics.visualDetailOctaveMilliseconds[Octave];
|
||||
DetailOctaveEligibleMillisecondsByLOD[LOD][Octave]+=
|
||||
Tile.CoreDiagnostics.visualDetailOctaveEligibleMilliseconds[Octave];
|
||||
}
|
||||
SkirtMsByLOD[LOD]+=Tile.CoreDiagnostics.marchingCubesSkirtMilliseconds;
|
||||
SkirtTrianglesByLOD[LOD]+=Tile.SkirtTriangleCount;
|
||||
if(bScreenSpaceGate&&Assembly&&Tile.Key.Level>=3&&Tile.Key.Level<9
|
||||
&&!Tile.Vertices.empty()
|
||||
&&StandaloneScreenSpaceGate::TileHasNativeSurface(Tile.Key,*Assembly,
|
||||
@@ -541,7 +456,8 @@ namespace StandaloneStreamBenchmark
|
||||
if(Assembly)
|
||||
bScreenSpaceGatePassing=StandaloneScreenSpaceGate::Run(GateSampleTiles,
|
||||
Streamer,*Assembly,ClosestDisplayDistances,World.CoreVoxelSizeMicrons,
|
||||
World.MaxClipLevel,PixelBudgetsSubvoxels);
|
||||
World.MaxClipLevel,PixelBudgetsSubvoxels,CameraYawDegrees,
|
||||
CameraPitchDegrees);
|
||||
else
|
||||
{std::fprintf(stderr,"[ScreenSpaceGateResult] no-world-assembly status=REJECT\n");bScreenSpaceGatePassing=false;}
|
||||
}
|
||||
@@ -576,19 +492,12 @@ namespace StandaloneStreamBenchmark
|
||||
}
|
||||
for(std::size_t LOD=0;LOD<TileCountByLOD.size();++LOD)
|
||||
{
|
||||
std::printf("[WorldAssemblerLODWorker] lod=%zu tiles=%llu worker_sum_s=%.6f column_eval_exclusive_ms=%.3f mc_exclusive_ms=%.3f ground_refine_exclusive_ms=%.3f cap_refine_exclusive_ms=%.3f mesh_assembly_ms=%.3f\n",
|
||||
std::printf("[WorldAssemblerLODWorker] lod=%zu tiles=%llu worker_sum_s=%.6f column_eval_exclusive_ms=%.3f mc_exclusive_ms=%.3f ground_refine_exclusive_ms=%.3f cap_refine_exclusive_ms=%.3f skirt_ms=%.3f skirt_triangles=%llu mesh_assembly_ms=%.3f\n",
|
||||
LOD,static_cast<unsigned long long>(TileCountByLOD[LOD]),WorkerSecondsByLOD[LOD],
|
||||
ColumnEvalMsByLOD[LOD],MarchingExclusiveMsByLOD[LOD],
|
||||
GroundRefineExclusiveMsByLOD[LOD],CapRefineExclusiveMsByLOD[LOD],MeshAssemblyMsByLOD[LOD]);
|
||||
if(bScreenSpaceGate)
|
||||
for(std::size_t Octave=0;Octave<8;++Octave)
|
||||
std::printf("[WorldAssemblerLODDetailOctave] lod=%zu octave=%zu evaluated=%llu budget_eligible=%llu skipped=%llu eval_ms=%.6f eligible_ms=%.6f\n",
|
||||
LOD,Octave,
|
||||
static_cast<unsigned long long>(DetailOctaveEvaluationsByLOD[LOD][Octave]),
|
||||
static_cast<unsigned long long>(DetailOctaveEligibleByLOD[LOD][Octave]),
|
||||
static_cast<unsigned long long>(DetailOctaveSkipsByLOD[LOD][Octave]),
|
||||
DetailOctaveMillisecondsByLOD[LOD][Octave],
|
||||
DetailOctaveEligibleMillisecondsByLOD[LOD][Octave]);
|
||||
GroundRefineExclusiveMsByLOD[LOD],CapRefineExclusiveMsByLOD[LOD],
|
||||
SkirtMsByLOD[LOD],static_cast<unsigned long long>(SkirtTrianglesByLOD[LOD]),
|
||||
MeshAssemblyMsByLOD[LOD]);
|
||||
}
|
||||
const double NeighborhoodSeconds=std::chrono::duration<double>(NeighborhoodReady-ColdStart).count();
|
||||
const double NeighborhoodMeshSeconds=std::chrono::duration<double>(NeighborhoodReady-ShapeReady).count();
|
||||
|
||||
Reference in new issue
Block a user