standalone: 64 m full-detail override, detailed round tunnels, optional mesh cache -- generation itself NOT faster
ClipRadius override 3 (64 m at 25 cm). Uncached full detail 20.3 s on 8 workers (512 tiles at ~51 ms serial each should be ~3-4 s: the in-stream inefficiency is unsolved); full clipmap 170.6 s. The 1 s / 5 s targets were met only from an on-disk mesh cache (.vfmesh, not committed) of already-generated tiles: a revisit speed-up, not generation speed. Round tunnels gained deterministic multi-scale wall relief and lost the larger mouth wedges (1.54% of lattice signs changed, mean 0.20 m). Hashes stable across runs and 1 vs 6 workers. 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
81b7d6d0ff
commit
5441c7da5c
181 files changed
+1674
-51
No files matched your search
@@ -8,7 +8,8 @@
|
||||
namespace FStandaloneResearchTunnels
|
||||
{
|
||||
inline std::atomic<bool> Enabled{false};
|
||||
inline std::atomic<float> CenterZVoxels{0.0f};
|
||||
inline std::atomic<bool> EnhancedWalls{true};
|
||||
inline constexpr float WorldCenterZVoxels=-80.0f;
|
||||
|
||||
inline uint32 Mix(uint32 X)
|
||||
{
|
||||
@@ -33,16 +34,63 @@ namespace FStandaloneResearchTunnels
|
||||
return static_cast<float>(Mix(X) >> 8) * (1.0f / 16777216.0f);
|
||||
}
|
||||
|
||||
inline void Set(bool bEnabled, float CenterZ)
|
||||
inline void Set(bool bEnabled, bool bEnhancedWalls = true)
|
||||
{
|
||||
CenterZVoxels.store(CenterZ,std::memory_order_relaxed);
|
||||
EnhancedWalls.store(bEnhancedWalls,std::memory_order_relaxed);
|
||||
Enabled.store(bEnabled,std::memory_order_release);
|
||||
}
|
||||
|
||||
inline uint32 NoiseHash(int32 X,int32 Y,int32 Z,uint32 Seed)
|
||||
{
|
||||
uint32 H=Mix(Seed^0xB5297A4Du);
|
||||
H=Mix(H^static_cast<uint32>(X)*0x68E31DA4u);
|
||||
H=Mix(H^static_cast<uint32>(Y)*0x1B56C4E9u);
|
||||
return Mix(H^static_cast<uint32>(Z)*0x9E3779B9u);
|
||||
}
|
||||
|
||||
inline float NoiseValue(int32 X,int32 Y,int32 Z,uint32 Seed)
|
||||
{
|
||||
return static_cast<float>(NoiseHash(X,Y,Z,Seed)>>8)*(2.0f/16777215.0f)-1.0f;
|
||||
}
|
||||
|
||||
inline float Fade(float T)
|
||||
{
|
||||
return T*T*(3.0f-2.0f*T);
|
||||
}
|
||||
|
||||
inline float ValueNoise(float X,float Y,float Z,int32 Wavelength,uint32 Seed)
|
||||
{
|
||||
const float Inv=1.0f/static_cast<float>(Wavelength);
|
||||
const float FX=X*Inv,FY=Y*Inv,FZ=Z*Inv;
|
||||
const int32 X0=FMath::FloorToInt(FX),Y0=FMath::FloorToInt(FY),Z0=FMath::FloorToInt(FZ);
|
||||
const float TX=Fade(FX-static_cast<float>(X0));
|
||||
const float TY=Fade(FY-static_cast<float>(Y0));
|
||||
const float TZ=Fade(FZ-static_cast<float>(Z0));
|
||||
const float Z00=FMath::Lerp(NoiseValue(X0,Y0,Z0,Seed),NoiseValue(X0+1,Y0,Z0,Seed),TX);
|
||||
const float Z10=FMath::Lerp(NoiseValue(X0,Y0+1,Z0,Seed),NoiseValue(X0+1,Y0+1,Z0,Seed),TX);
|
||||
const float Z01=FMath::Lerp(NoiseValue(X0,Y0,Z0+1,Seed),NoiseValue(X0+1,Y0,Z0+1,Seed),TX);
|
||||
const float Z11=FMath::Lerp(NoiseValue(X0,Y0+1,Z0+1,Seed),NoiseValue(X0+1,Y0+1,Z0+1,Seed),TX);
|
||||
return FMath::Lerp(FMath::Lerp(Z00,Z10,TY),FMath::Lerp(Z01,Z11,TY),TZ);
|
||||
}
|
||||
|
||||
inline float WallRelief(float X,float Y,float Z,uint32 Seed)
|
||||
{
|
||||
return 0.70f*ValueNoise(X,Y,Z,8,Seed^0xA511E9B3u)
|
||||
+1.05f*ValueNoise(X,Y,Z,16,Seed^0x63D83595u)
|
||||
+1.45f*ValueNoise(X,Y,Z,32,Seed^0xB5297A4Du);
|
||||
}
|
||||
|
||||
inline float SmoothMax(float A,float B,float Width)
|
||||
{
|
||||
const float H=FMath::Max(Width-FMath::Abs(A-B),0.0f)/Width;
|
||||
return FMath::Max(A,B)+(H*H)*(Width*0.25f);
|
||||
}
|
||||
|
||||
inline float Apply(float BaseDensity, float X, float Y, float Z, uint32 Seed)
|
||||
{
|
||||
if (!Enabled.load(std::memory_order_acquire)) return BaseDensity;
|
||||
const float CenterZ = CenterZVoxels.load(std::memory_order_relaxed);
|
||||
constexpr float CenterZ = WorldCenterZVoxels;
|
||||
const bool bEnhancedWalls=EnhancedWalls.load(std::memory_order_relaxed);
|
||||
if (FMath::Abs(Z-CenterZ) > 36.0f) return BaseDensity;
|
||||
|
||||
constexpr float Pitch = 144.0f;
|
||||
@@ -106,15 +154,17 @@ namespace FStandaloneResearchTunnels
|
||||
const float Distance=FMath::Sqrt(DX*DX+DY*DY);
|
||||
const float Phase=Unit(H^0xA511E9B3u)*6.2831853071795864769f;
|
||||
const float Radius=RadiusBase*(0.82f+0.36f*Unit(H^0x63D83595u))
|
||||
*(1.0f+0.22f*FMath::Sin(6.2831853071795864769f*T+Phase));
|
||||
const float VerticalWave=4.0f*FMath::Sin(3.14159265358979323846f*T)
|
||||
*FMath::Sin(6.2831853071795864769f*T+Phase);
|
||||
*(1.0f+0.22f*VoxelMath::DetSin(6.2831853071795864769f*T+Phase));
|
||||
const float VerticalWave=4.0f*VoxelMath::DetSin(3.14159265358979323846f*T)
|
||||
*VoxelMath::DetSin(6.2831853071795864769f*T+Phase);
|
||||
const float VerticalOffset=Z-(CenterZ+VerticalWave);
|
||||
const float HorizontalDistance=FMath::Max(0.0f,Distance);
|
||||
const float Normalized=FMath::Sqrt(
|
||||
FMath::Square(HorizontalDistance/FMath::Max(Radius,1.0f))
|
||||
+FMath::Square(VerticalOffset/FMath::Max(HalfHeight,1.0f)));
|
||||
Best=FMath::Max(Best,(1.0f-Normalized)*FMath::Min(Radius,HalfHeight));
|
||||
const float EdgeDensity=(1.0f-Normalized)*FMath::Min(Radius,HalfHeight);
|
||||
Best=bEnhancedWalls&&Best>-FLT_MAX
|
||||
?SmoothMax(Best,EdgeDensity,4.0f):FMath::Max(Best,EdgeDensity);
|
||||
};
|
||||
|
||||
for (int32 CY=BaseCellY-1;CY<=BaseCellY+1;++CY)
|
||||
@@ -123,6 +173,11 @@ namespace FStandaloneResearchTunnels
|
||||
EvaluateEdge(CX,CY,0);
|
||||
EvaluateEdge(CX,CY,1);
|
||||
}
|
||||
return bHasEdge ? FMath::Max(BaseDensity,Best) : BaseDensity;
|
||||
if(!bHasEdge)return BaseDensity;
|
||||
if(bEnhancedWalls)Best+=WallRelief(X,Y,Z,Seed);
|
||||
// The wider base/round-field blend removes tiny marching-cubes wedges where a round
|
||||
// branch meets an existing room or passage wall. Relief remains active on the tunnel
|
||||
// wall; this only rounds the structural union boundary.
|
||||
return bEnhancedWalls?SmoothMax(BaseDensity,Best,8.0f):FMath::Max(BaseDensity,Best);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user