standalone: canonical AVX2 noise + factored lattice hashes -- whole view 1.40 -> 1.09 s, world unchanged
- Octave noise evaluated in AVX2 batches (one canonical path), fBM and ridged share samples, lattice hash products factored; the outputs are preserved: W1/W8 and pre-change hashes equal across 44 fields, six fixed captures pixel-identical, remote views differ by at most one pixel. - Routes 5642/5642, shape and far-survival audits pass, bad-shell control still fails. Verified by me, interleaved head to head (8 workers, cold, BelowNormal 0xFF00): 1.092 / 1.098 s vs 1.408 / 1.396 s for round 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
1 parent
d4fa89204d
commit
16612acba4
5 files changed
+459
-148
No files matched your search
@@ -2500,6 +2500,10 @@ private:
|
||||
const int32 Y=Min[1]+static_cast<int32>(Line/Size[0]);
|
||||
FDetailNoiseLineContext NoiseLine(static_cast<float>(X),static_cast<float>(Y),
|
||||
static_cast<uint32>(Owner->Seed));
|
||||
const int32 QueryBinX=FloorDiv(X,ActiveSpatialBinSize);
|
||||
const int32 QueryBinY=FloorDiv(Y,ActiveSpatialBinSize);
|
||||
int32 CachedQueryBinZ=std::numeric_limits<int32>::min();
|
||||
const FBinItems* CachedQueryBinItems=nullptr;
|
||||
FDetailWorkerProfile& Profile=WorkerProfile[static_cast<size_t>(Worker)];
|
||||
if(bProfile)++Profile.Lines;
|
||||
uint64 LocalCandidates=0,LocalProxies=0,LocalFlips=0;
|
||||
@@ -2514,12 +2518,20 @@ private:
|
||||
const size_t Zi=W*64+Bit;if(Zi>=static_cast<size_t>(Size[2]))continue;
|
||||
const int32 Z=Min[2]+static_cast<int32>(Zi);
|
||||
++LocalCandidates;
|
||||
const int32 QueryBinZ=FloorDiv(Z,ActiveSpatialBinSize);
|
||||
if(QueryBinZ!=CachedQueryBinZ)
|
||||
{
|
||||
const auto Bin=SpatialBins.find({QueryBinX,QueryBinY,QueryBinZ});
|
||||
CachedQueryBinItems=Bin==SpatialBins.end()?nullptr:&Bin->second;
|
||||
CachedQueryBinZ=QueryBinZ;
|
||||
}
|
||||
const bool bTimeDistance=bProfile&&((Profile.Candidates++&255u)==0);
|
||||
const auto DistanceStart=bTimeDistance?Clock::now():Clock::time_point{};
|
||||
ESurfaceFamily SurfaceFamily=ESurfaceFamily::Strata;float SurfaceSDF=100000.0f;
|
||||
bool bFloorSurface=false,bCriticalAir=false;float CaveInfluence=0.0f,FloorInfluence=0.0f;
|
||||
const float SDF=EffectiveRockDistance(X,Y,Z,&SurfaceFamily,&SurfaceSDF,
|
||||
&bFloorSurface,&CaveInfluence,&FloorInfluence,&bCriticalAir);
|
||||
&bFloorSurface,&CaveInfluence,&FloorInfluence,&bCriticalAir,
|
||||
CachedQueryBinItems,true);
|
||||
if(bTimeDistance)
|
||||
{
|
||||
Profile.DistanceSampleNanoseconds+=static_cast<uint64>(
|
||||
@@ -2768,17 +2780,24 @@ private:
|
||||
bool* OutFloorSurface=nullptr,
|
||||
float* OutCaveInfluence=nullptr,
|
||||
float* OutFloorInfluence=nullptr,
|
||||
bool* OutCriticalAir=nullptr) const
|
||||
bool* OutCriticalAir=nullptr,
|
||||
const FBinItems* KnownBinItems=nullptr,
|
||||
bool bKnownBin=false) const
|
||||
{
|
||||
const float Base=StrataDistance(Z);
|
||||
float Cave=100000.0f;
|
||||
float Overlay=-100000.0f;
|
||||
float CaveFloorInfluence=0.0f;
|
||||
bool bCriticalAir=false;
|
||||
const auto Bin=SpatialBins.find(PointBin(X,Y,Z));
|
||||
if(Bin!=SpatialBins.end())
|
||||
const FBinItems* BinItems=KnownBinItems;
|
||||
if(!bKnownBin)
|
||||
{
|
||||
for(uint32 Id:Bin->second)
|
||||
const auto Bin=SpatialBins.find(PointBin(X,Y,Z));
|
||||
if(Bin!=SpatialBins.end())BinItems=&Bin->second;
|
||||
}
|
||||
if(BinItems)
|
||||
{
|
||||
for(uint32 Id:*BinItems)
|
||||
{
|
||||
const FPrimitive& P=Primitives[Id];
|
||||
if(P.bCarve)
|
||||
@@ -2839,10 +2858,26 @@ private:
|
||||
const float Base=StrataDistance(Z);
|
||||
float Cave=100000.0f,Overlay=-100000.0f;
|
||||
bool bCriticalAir=false;
|
||||
const auto Bin=SpatialBins.find(PointBin(X,Y,Z));
|
||||
if(Bin!=SpatialBins.end())
|
||||
struct FCoarseBinCache
|
||||
{
|
||||
for(uint32 Id:Bin->second)
|
||||
const FStandaloneShapeWorld* Owner=nullptr;
|
||||
FBinKey Key{};
|
||||
const FBinItems* Items=nullptr;
|
||||
bool Valid=false;
|
||||
};
|
||||
static thread_local FCoarseBinCache LastQuery;
|
||||
const FBinKey QueryKey=PointBin(X,Y,Z);
|
||||
if(!LastQuery.Valid||LastQuery.Owner!=this||!(LastQuery.Key==QueryKey))
|
||||
{
|
||||
const auto Bin=SpatialBins.find(QueryKey);
|
||||
LastQuery.Owner=this;
|
||||
LastQuery.Key=QueryKey;
|
||||
LastQuery.Items=Bin==SpatialBins.end()?nullptr:&Bin->second;
|
||||
LastQuery.Valid=true;
|
||||
}
|
||||
if(LastQuery.Items)
|
||||
{
|
||||
for(uint32 Id:*LastQuery.Items)
|
||||
{
|
||||
const FPrimitive& P=Primitives[Id];
|
||||
if(P.bCarve)
|
||||
@@ -2895,37 +2930,51 @@ private:
|
||||
if(Params.DomainWarpStrength>0.0f)
|
||||
{
|
||||
const float WF=Params.DomainWarpFrequency,WS=Params.DomainWarpStrength;
|
||||
const float WX=VoxelNoise::Perlin3D(FVector3f(
|
||||
float WX=0.0f,WY=0.0f,WZ=0.0f;
|
||||
VoxelNoise::Perlin3D_x3(
|
||||
static_cast<float>(X)*WF+VoxelHash::SeedOffset(Seed,5.2f),
|
||||
static_cast<float>(Y)*WF+VoxelHash::SeedOffset(Seed,1.3f),
|
||||
EffectiveZ*WF+VoxelHash::SeedOffset(Seed,9.7f)))*VOXEL_NOISE_SCALE*WS;
|
||||
const float WY=VoxelNoise::Perlin3D(FVector3f(
|
||||
EffectiveZ*WF+VoxelHash::SeedOffset(Seed,9.7f),
|
||||
static_cast<float>(X)*WF+100.0f+VoxelHash::SeedOffset(Seed,7.7f),
|
||||
static_cast<float>(Y)*WF+200.0f+VoxelHash::SeedOffset(Seed,3.1f),
|
||||
EffectiveZ*WF+300.0f))*VOXEL_NOISE_SCALE*WS;
|
||||
const float WZ=VoxelNoise::Perlin3D(FVector3f(
|
||||
EffectiveZ*WF+300.0f,
|
||||
static_cast<float>(X)*WF+400.0f,
|
||||
static_cast<float>(Y)*WF+500.0f+VoxelHash::SeedOffset(Seed,11.9f),
|
||||
EffectiveZ*WF+600.0f+VoxelHash::SeedOffset(Seed,13.3f)))*VOXEL_NOISE_SCALE*WS;
|
||||
EffectiveZ*WF+600.0f+VoxelHash::SeedOffset(Seed,13.3f),WX,WY,WZ);
|
||||
WX*=VOXEL_NOISE_SCALE*WS;WY*=VOXEL_NOISE_SCALE*WS;WZ*=VOXEL_NOISE_SCALE*WS;
|
||||
Main+=FVector3f(WX,WY,WZ);Fine+=FVector3f(WX,WY,WZ);
|
||||
}
|
||||
float Rough=0.0f,FineValue=0.0f;
|
||||
switch(Params.RoughnessNoiseType)
|
||||
{
|
||||
case EVoxelNoiseType::Ridged:
|
||||
Rough=VoxelNoise::Ridged(Main.X,Main.Y,Main.Z,3);
|
||||
FineValue=VoxelNoise::Ridged(Fine.X,Fine.Y,Fine.Z,2);break;
|
||||
{
|
||||
float MainFBM=0.0f,MainRidged=0.0f,FineFBM=0.0f,FineRidged=0.0f;
|
||||
VoxelNoise::FractalPair<false,true>(Main.X,Main.Y,Main.Z,3,
|
||||
Fine.X,Fine.Y,Fine.Z,2,MainFBM,MainRidged,FineFBM,FineRidged);
|
||||
Rough=MainRidged;FineValue=FineRidged;
|
||||
break;
|
||||
}
|
||||
case EVoxelNoiseType::Mixed:
|
||||
Rough=0.5f*(VoxelNoise::FBM(Main.X,Main.Y,Main.Z,3)
|
||||
+VoxelNoise::Ridged(Main.X,Main.Y,Main.Z,3));
|
||||
FineValue=0.5f*(VoxelNoise::FBM(Fine.X,Fine.Y,Fine.Z,2)
|
||||
+VoxelNoise::Ridged(Fine.X,Fine.Y,Fine.Z,2));break;
|
||||
{
|
||||
float MainFBM=0.0f,MainRidged=0.0f,FineFBM=0.0f,FineRidged=0.0f;
|
||||
VoxelNoise::FractalPair<true,true>(Main.X,Main.Y,Main.Z,3,
|
||||
Fine.X,Fine.Y,Fine.Z,2,MainFBM,MainRidged,FineFBM,FineRidged);
|
||||
Rough=MainFBM*0.5f+MainRidged*0.5f;
|
||||
FineValue=FineFBM*0.5f+FineRidged*0.5f;
|
||||
break;
|
||||
}
|
||||
case EVoxelNoiseType::Cellular:
|
||||
Rough=VoxelNoise::Cellular3D(Main);FineValue=VoxelNoise::Cellular3D(Fine);break;
|
||||
case EVoxelNoiseType::FBM:
|
||||
default:
|
||||
Rough=VoxelNoise::FBM(Main.X,Main.Y,Main.Z,3);
|
||||
FineValue=VoxelNoise::FBM(Fine.X,Fine.Y,Fine.Z,2);break;
|
||||
{
|
||||
float MainFBM=0.0f,MainRidged=0.0f,FineFBM=0.0f,FineRidged=0.0f;
|
||||
VoxelNoise::FractalPair<true,false>(Main.X,Main.Y,Main.Z,3,
|
||||
Fine.X,Fine.Y,Fine.Z,2,MainFBM,MainRidged,FineFBM,FineRidged);
|
||||
Rough=MainFBM;FineValue=FineFBM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (Rough+FineValue*0.4f)*VOXEL_NOISE_SCALE*Params.SurfaceRoughness;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user