p.LevelSetAvgAngleErrorTolerance
p.LevelSetAvgAngleErrorTolerance
#Overview
name: p.LevelSetAvgAngleErrorTolerance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Average error in of the mesh normal and computed normal on the level set.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.LevelSetAvgAngleErrorTolerance is to set the tolerance for the average error between the mesh normal and the computed normal on the level set in Unreal Engine’s Chaos physics system.
This setting variable is primarily used in the Chaos physics system, which is an experimental physics engine in Unreal Engine 5. It is specifically utilized in the level set functionality, which is a method for representing surfaces in physics simulations.
The value of this variable is set through the Unreal Engine console variable system. It is defined using FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable AvgAngleErrorTolerance directly interacts with p.LevelSetAvgAngleErrorTolerance. They share the same value, with AvgAngleErrorTolerance being the actual variable used in the code, while p.LevelSetAvgAngleErrorTolerance is the console variable name used to set its value.
Developers must be aware that this variable affects the accuracy of the level set representation. A higher tolerance allows for more deviation between the mesh normal and the computed normal, potentially leading to less accurate but faster simulations. Conversely, a lower tolerance enforces more accuracy but may increase computational cost.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project, balancing between accuracy and performance.
- Testing different values to find the optimal setting for your use case.
- Being cautious when modifying it, as it can significantly impact the behavior of physics simulations.
- Considering it in conjunction with other level set error tolerances like p.LevelSetMaxDistErrorTolerance for a comprehensive approach to managing level set accuracy.
Regarding the associated variable AvgAngleErrorTolerance:
The purpose of AvgAngleErrorTolerance is to store the actual value used in the Chaos physics calculations for the average angle error tolerance in level sets.
It is used directly in the Chaos namespace, specifically in the FLevelSet::CheckData function. This function appears to validate the level set data against various error tolerances.
The value of AvgAngleErrorTolerance is set through the p.LevelSetAvgAngleErrorTolerance console variable, allowing for runtime adjustment.
It interacts closely with other error tolerance variables like AvgDistErrorTolerance and MaxDistErrorTolerance in the level set validation process.
Developers should be aware that this variable directly affects the acceptance criteria for level set data. If the average angle error exceeds this tolerance, it may trigger warnings or potentially invalidate the level set.
Best practices for using AvgAngleErrorTolerance include:
- Coordinating its value with other error tolerances to ensure consistent behavior.
- Monitoring its impact on both simulation accuracy and performance.
- Considering adjusting it when dealing with models that have complex geometry or require high precision in normal calculations.
#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:29
Scope: file
Source code excerpt:
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"));
int32 NumOverlapCapsuleSamples = 24;
FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples(TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule overlaps"));
#Associated Variable and Callsites
This variable is associated with another variable named AvgAngleErrorTolerance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:28
Scope: file
Source code excerpt:
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"));
int32 NumOverlapCapsuleSamples = 24;
FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples(TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule 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:595
Scope (from outer to inner):
file
namespace Chaos
function bool FLevelSet::CheckData
Source code excerpt:
AvgDistError, AvgDistErrorTolerance, MGrid.Dx().Size(),
MaxDistError, MaxDistErrorTolerance, MGrid.Dx().Size(),
AvgAngleError, AvgAngleErrorTolerance);
ErrorReporter.ReportError(*ErrorStr);
return false;
}
else
{
UE_LOG(LogChaos, Log, TEXT("%s: High error for level set: AvgDistError: %f (Max: %f*%f), MaxDistError: %f (Max: %f*%f), AvgAngleError: %f (Max: %f)"),
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:605
Scope (from outer to inner):
file
namespace Chaos
function bool FLevelSet::CheckData
Source code excerpt:
AvgDistError, AvgDistErrorTolerance, MGrid.Dx().Size(),
MaxDistError, MaxDistErrorTolerance, MGrid.Dx().Size(),
AvgAngleError, AvgAngleErrorTolerance);
}
}
return true;
}