You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Add option to drive adding more negative space samples when the current samples don't cover the space identified by Voxel Search (and are farther apart than the target Sample Spacing), to make the negative space coverage algorithm better able to protect space in challenging cases where a smaller fixed number of samples would fail.
#rb rinat.abdrashitov [CL 26314665 by jimmy andrews in ue5-main branch]
This commit is contained in:
@@ -265,6 +265,31 @@ bool FSphereCovering::AddNegativeSpace(const TFastWindingTree<FDynamicMesh3>& Sp
|
||||
int32 VID = Ordering.Order[SampleIdx];
|
||||
AddSample(MorphologyMesh.GetVertex(VID));
|
||||
}
|
||||
|
||||
if (SampleSettings.bRequireSearchSampleCoverage)
|
||||
{
|
||||
double SpacingThresholdSq = SampleSettings.MinSpacing * SampleSettings.MinSpacing;
|
||||
for (int32 SampleIdx = NumSamples; SampleIdx < Ordering.Order.Num(); ++SampleIdx)
|
||||
{
|
||||
int32 VID = Ordering.Order[SampleIdx];
|
||||
FVector3d Pos = MorphologyMesh.GetVertex(VID);
|
||||
// TODO: Consider accelerating this coverage search w/ e.g. a sparse dynamic octree representation of the sphere covering
|
||||
bool bFoundCover = false;
|
||||
for (int32 SphereIdx = 0; SphereIdx < Position.Num(); ++SphereIdx)
|
||||
{
|
||||
double ThreshSq = FMath::Max(SpacingThresholdSq, Radius[SphereIdx] * Radius[SphereIdx]);
|
||||
if (FVector3d::DistSquared(Position[SphereIdx], Pos) < ThreshSq)
|
||||
{
|
||||
bFoundCover = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFoundCover)
|
||||
{
|
||||
AddSample(Pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user