p.LevelSetMaxDistErrorTolerance
p.LevelSetMaxDistErrorTolerance
#Overview
name: p.LevelSetMaxDistErrorTolerance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.LevelSetMaxDistErrorTolerance is to set the maximum error tolerance for the highest error triangle generated from a levelset in Unreal Engine’s Chaos physics system. This variable is used in the level set generation process, which is part of the physics simulation and collision detection system.
This setting variable is primarily used in the Chaos experimental physics module of Unreal Engine 5. It’s specifically utilized in the level set generation and validation process within the FLevelSet class.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. It’s initialized with a default value of 1.0f.
The p.LevelSetMaxDistErrorTolerance interacts closely with other level set-related variables, such as p.LevelSetAvgDistErrorTolerance and p.LevelSetAvgAngleErrorTolerance. These variables work together to define the acceptable error margins for the level set generation process.
Developers must be aware that this variable represents a fraction of the average bounding box dimensions. It’s used in error checking and validation of the generated level set, particularly in the FLevelSet::CheckData function.
Best practices when using this variable include:
- Adjusting it carefully, as it directly affects the accuracy of the physics simulation.
- Considering it in conjunction with the average distance error tolerance and angle error tolerance for a comprehensive error control strategy.
- Monitoring its impact on performance, as stricter tolerances may increase computation time.
Regarding the associated variable MaxDistErrorTolerance:
The purpose of MaxDistErrorTolerance is to store the actual value used in the code for the maximum distance error tolerance. It’s directly linked to the p.LevelSetMaxDistErrorTolerance console variable.
This variable is used within the Chaos physics system, specifically in the level set generation and validation process.
The value of MaxDistErrorTolerance is set by the console variable p.LevelSetMaxDistErrorTolerance, allowing for runtime modification.
MaxDistErrorTolerance interacts closely with AvgDistErrorTolerance and AvgAngleErrorTolerance in the level set error checking process.
Developers should be aware that changes to p.LevelSetMaxDistErrorTolerance will directly affect MaxDistErrorTolerance, and consequently, the level set validation process.
Best practices for MaxDistErrorTolerance include:
- Ensuring that any code using this variable is prepared to handle potential runtime changes.
- Using it consistently throughout the level set-related code for uniform error tolerance application.
- Considering its impact on both accuracy and performance when adjusting its value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:26
Scope: file
Source code excerpt:
Chaos::FRealSingle MaxDistErrorTolerance = 1.f;
FAutoConsoleVariableRef CVarMaxDistErrorTolerance(TEXT("p.LevelSetMaxDistErrorTolerance"), MaxDistErrorTolerance, TEXT("Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions."));
Chaos::FRealSingle AvgAngleErrorTolerance = 1.;
FAutoConsoleVariableRef CVarAvgAngleErrorTolerance(TEXT("p.LevelSetAvgAngleErrorTolerance"), AvgAngleErrorTolerance, TEXT("Average error in of the mesh normal and computed normal on the level set."));
int32 NumOverlapSphereSamples = 16;
FAutoConsoleVariableRef CVarNumOverlapSphereSamples(TEXT("p.LevelsetOverlapSphereSamples"), NumOverlapSphereSamples, TEXT("Number of spiral points to generate for levelset-sphere overlaps"));
#Associated Variable and Callsites
This variable is associated with another variable named MaxDistErrorTolerance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:25
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarAvgDistErrorTolerance(TEXT("p.LevelSetAvgDistErrorTolerance"), AvgDistErrorTolerance, TEXT("Error tolerance for average distance between the triangles and generated levelset. Note this is a fraction of the average bounding box dimensions."));
Chaos::FRealSingle MaxDistErrorTolerance = 1.f;
FAutoConsoleVariableRef CVarMaxDistErrorTolerance(TEXT("p.LevelSetMaxDistErrorTolerance"), MaxDistErrorTolerance, TEXT("Max error for the highest error triangle generated from a levelset. Note this is a fraction of the average bounding box dimensions."));
Chaos::FRealSingle AvgAngleErrorTolerance = 1.;
FAutoConsoleVariableRef CVarAvgAngleErrorTolerance(TEXT("p.LevelSetAvgAngleErrorTolerance"), AvgAngleErrorTolerance, TEXT("Average error in of the mesh normal and computed normal on the level set."));
int32 NumOverlapSphereSamples = 16;
FAutoConsoleVariableRef CVarNumOverlapSphereSamples(TEXT("p.LevelsetOverlapSphereSamples"), NumOverlapSphereSamples, TEXT("Number of spiral points to generate for levelset-sphere overlaps"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:582
Scope (from outer to inner):
file
namespace Chaos
function bool FLevelSet::CheckData
Source code excerpt:
// Report high error, but don't report it as an invalid level set
if (AvgDistError > AvgDistErrorTolerance*MGrid.Dx().Size() || AvgAngleError > AvgAngleErrorTolerance || MaxDistError > MaxDistErrorTolerance*MGrid.Dx().Size())
{
if (OutputFailedLevelSetDebugData)
{
FString Prefix = FString::Printf(TEXT("AVGDIST_%f__MAXDIST_%f__ANGLE_%f___"), AvgDistError, MaxDistError, AvgAngleError) + ObjectNamePrefixNoSpace;
OutputDebugData(ErrorReporter, InParticles, Normals, Mesh, Prefix);
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:594
Scope (from outer to inner):
file
namespace Chaos
function bool FLevelSet::CheckData
Source code excerpt:
FString ErrorStr = FString::Printf(TEXT("High error for level set: AvgDistError: %f (Max: %f*%f), MaxDistError: %f (Max: %f*%f), AvgAngleError: %f (Max: %f)"),
AvgDistError, AvgDistErrorTolerance, MGrid.Dx().Size(),
MaxDistError, MaxDistErrorTolerance, MGrid.Dx().Size(),
AvgAngleError, AvgAngleErrorTolerance);
ErrorReporter.ReportError(*ErrorStr);
return false;
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:604
Scope (from outer to inner):
file
namespace Chaos
function bool FLevelSet::CheckData
Source code excerpt:
*ErrorReporter.GetPrefix(),
AvgDistError, AvgDistErrorTolerance, MGrid.Dx().Size(),
MaxDistError, MaxDistErrorTolerance, MGrid.Dx().Size(),
AvgAngleError, AvgAngleErrorTolerance);
}
}
return true;
}