p.Chaos.Collision.MeshManifoldHashSize
p.Chaos.Collision.MeshManifoldHashSize
#Overview
name: p.Chaos.Collision.MeshManifoldHashSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Hash table size to use in vertex and edge maps in convex-mesh collision
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.MeshManifoldHashSize is to set the hash table size used in vertex and edge maps for convex-mesh collision detection in Unreal Engine’s Chaos physics system.
This setting variable is primarily used by the Chaos physics subsystem, specifically in the collision detection module. It’s part of the experimental Chaos framework within Unreal Engine 5.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 256 and can be changed at runtime using the console command “p.Chaos.Collision.MeshManifoldHashSize”.
The associated variable Chaos_Collision_MeshManifoldHashSize directly interacts with p.Chaos.Collision.MeshManifoldHashSize. They share the same value, with Chaos_Collision_MeshManifoldHashSize being the actual variable used in the C++ code.
Developers should be aware that this variable affects the performance and accuracy of convex-mesh collision detection. A larger hash size can potentially improve collision detection accuracy but may increase memory usage and potentially impact performance.
Best practices when using this variable include:
- Experimenting with different values to find the optimal balance between collision accuracy and performance for your specific use case.
- Monitoring performance metrics when adjusting this value, especially in scenes with many complex collisions.
- Considering the target hardware when setting this value, as higher values may be more suitable for more powerful systems.
Regarding the associated variable Chaos_Collision_MeshManifoldHashSize:
- Its purpose is the same as p.Chaos.Collision.MeshManifoldHashSize, serving as the internal representation of the hash table size.
- It’s used directly in the Chaos physics system’s collision detection code, particularly in the MeshContactGenerator.
- The value is set from the console variable p.Chaos.Collision.MeshManifoldHashSize.
- It’s used to initialize the HashSize member of FMeshContactGeneratorSettings, which is rounded up to the nearest power of two.
- Developers should be aware that changes to p.Chaos.Collision.MeshManifoldHashSize will directly affect this variable and, consequently, the collision detection behavior.
- Best practices include ensuring that any code relying on this variable can handle potential runtime changes to 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/CollisionOneShotManifolds.cpp:98
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
int32 Chaos_Collision_MeshManifoldHashSize = 256;
FAutoConsoleVariableRef CVarChaos_Collision_MeshManifoldHashSize(TEXT("p.Chaos.Collision.MeshManifoldHashSize"), Chaos_Collision_MeshManifoldHashSize, TEXT("Hash table size to use in vertex and edge maps in convex-mesh collision"));
// @todo(chaos): Temp while we test the new convex-mesh collision optimizations
bool bChaos_Collision_EnableMeshManifoldOptimizedLoop = true;
bool bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh = true;
FAutoConsoleVariableRef CVarChaos_Collision_EnableMeshManifoldOptimizedLoop(TEXT("p.Chaos.Collision.EnableMeshManifoldOptimizedLoop"), bChaos_Collision_EnableMeshManifoldOptimizedLoop, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh(TEXT("p.Chaos.Collision.EnableMeshManifoldOptimizedLoopTriMesh"), bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_MeshManifoldHashSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/MeshContactGenerator.cpp:7
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
extern FRealSingle Chaos_Collision_MeshContactNormalThreshold;
extern FRealSingle Chaos_Collision_MeshContactNormalRejectionThreshold;
extern int32 Chaos_Collision_MeshManifoldHashSize;
}
namespace Chaos::CVars
{
extern int32 ChaosSolverDebugDrawMeshContacts;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/MeshContactGenerator.cpp:22
Scope (from outer to inner):
file
namespace Chaos::Private
function FMeshContactGeneratorSettings::FMeshContactGeneratorSettings
Source code excerpt:
FMeshContactGeneratorSettings::FMeshContactGeneratorSettings()
{
HashSize = FMath::RoundUpToPowerOfTwo(Chaos_Collision_MeshManifoldHashSize);
FaceNormalDotThreshold = Chaos_Collision_MeshContactNormalThreshold;
EdgeNormalDotRejectTolerance = Chaos_Collision_MeshContactNormalRejectionThreshold;
BarycentricTolerance = FReal(1.e-3);
MaxContactsBufferSize = 1000;
bCullBackFaces = true;
bFixNormals = true;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:97
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarChaos_Collision_LargeMeshManifoldSortByDistance(TEXT("p.Chaos.Collision.SortMeshManifoldByDistance"), bChaos_Collision_MeshManifoldSortByDistance, TEXT("Sort large mesh manifold points by |RxN| for improved solver stability (less rotation in first iteration)"));
int32 Chaos_Collision_MeshManifoldHashSize = 256;
FAutoConsoleVariableRef CVarChaos_Collision_MeshManifoldHashSize(TEXT("p.Chaos.Collision.MeshManifoldHashSize"), Chaos_Collision_MeshManifoldHashSize, TEXT("Hash table size to use in vertex and edge maps in convex-mesh collision"));
// @todo(chaos): Temp while we test the new convex-mesh collision optimizations
bool bChaos_Collision_EnableMeshManifoldOptimizedLoop = true;
bool bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh = true;
FAutoConsoleVariableRef CVarChaos_Collision_EnableMeshManifoldOptimizedLoop(TEXT("p.Chaos.Collision.EnableMeshManifoldOptimizedLoop"), bChaos_Collision_EnableMeshManifoldOptimizedLoop, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh(TEXT("p.Chaos.Collision.EnableMeshManifoldOptimizedLoopTriMesh"), bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifoldsMeshShapes.cpp:33
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
extern FRealSingle Chaos_Collision_TriMeshDistanceTolerance;
extern FRealSingle Chaos_Collision_TriMeshPhiToleranceScale;
extern int32 Chaos_Collision_MeshManifoldHashSize;
extern bool bChaos_Collision_EnableMeshManifoldOptimizedLoop;
extern bool bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh;
extern bool bChaos_Collision_EnableMACDFallback;
extern bool bChaos_Collision_UseCapsuleTriMesh2;
extern bool bChaos_Collision_UseConvexTriMesh2;