p.LevelsetOverlapSphereSamples
p.LevelsetOverlapSphereSamples
#Overview
name: p.LevelsetOverlapSphereSamples
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of spiral points to generate for levelset-sphere overlaps
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.LevelsetOverlapSphereSamples is to control the number of spiral points generated for levelset-sphere overlaps in the Chaos physics engine of Unreal Engine 5. This setting is used in the collision detection system, specifically for improving the accuracy of collision checks between levelsets and spheres.
This setting variable is primarily used in the Chaos physics module, which is an experimental physics engine in Unreal Engine 5. It’s part of the collision detection system within this module.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files. The default value is set to 16.
The associated variable NumOverlapSphereSamples directly interacts with p.LevelsetOverlapSphereSamples. They share the same value, with NumOverlapSphereSamples being the actual variable used in the code, while p.LevelsetOverlapSphereSamples is the console variable name for runtime modification.
Developers should be aware that increasing this value will improve the accuracy of sphere-levelset collision detection at the cost of performance. Conversely, decreasing it will improve performance but may reduce collision accuracy.
Best practices when using this variable include:
- Balancing between performance and accuracy based on the specific needs of the game or simulation.
- Testing different values to find the optimal setting for your particular use case.
- Considering the impact on both collision detection accuracy and performance when modifying this value.
Regarding the associated variable NumOverlapSphereSamples:
The purpose of NumOverlapSphereSamples is to store the actual number of spiral points used for levelset-sphere overlaps in the Chaos physics engine.
This variable is used directly in the collision detection system of the Chaos physics module. It’s specifically used in the GetGeomSurfaceSamplesExtended function for sphere geometries.
The value of NumOverlapSphereSamples is set by the console variable p.LevelsetOverlapSphereSamples, allowing for runtime modification.
NumOverlapSphereSamples interacts directly with the TSphere class’s ComputeLocalSamplePoints method, determining the number of sample points to generate on the sphere’s surface for collision checks.
Developers should be aware that this variable directly affects the collision detection accuracy and performance for sphere-levelset interactions.
Best practices for using NumOverlapSphereSamples include:
- Avoiding direct modification of this variable in code, instead using the console variable p.LevelsetOverlapSphereSamples for changes.
- Considering the performance impact when increasing this value, especially in scenarios with many sphere-levelset collision checks.
- Balancing the need for accurate collision detection with performance requirements of the game or simulation.
#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:32
Scope: file
Source code excerpt:
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"));
#define MAX_CLAMP(a, comp, b) (a >= comp ? b : a)
#define MIN_CLAMP(a, comp, b) (a < comp ? b : a)
#Associated Variable and Callsites
This variable is associated with another variable named NumOverlapSphereSamples
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:31
Scope: file
Source code excerpt:
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"));
#define MAX_CLAMP(a, comp, b) (a >= comp ? b : a)
#define MIN_CLAMP(a, comp, b) (a < comp ? b : a)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:1702
Scope (from outer to inner):
file
namespace Chaos
function void GetGeomSurfaceSamplesExtended
Source code excerpt:
void GetGeomSurfaceSamplesExtended(const TSphere<FReal, 3>& InGeom, TArray<FVec3>& OutSamples)
{
OutSamples = InGeom.ComputeLocalSamplePoints(NumOverlapSphereSamples);
}
void GetGeomSurfaceSamplesExtended(const TBox<FReal, 3>& InGeom, TArray<FVec3>& OutSamples)
{
OutSamples = InGeom.ComputeLocalSamplePoints();
}