p.MaxLevelsetDimension
p.MaxLevelsetDimension
#Overview
name: p.MaxLevelsetDimension
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The maximum number of cells on a single level set axis
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.MaxLevelsetDimension is to set the maximum number of cells on a single level set axis in the Chaos physics system of Unreal Engine 5. This setting is primarily used for the physics simulation, specifically for the rigid body clustering algorithm.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics system, which is part of the Experimental module. This can be inferred from the file path “Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClusteringAlgo.cpp”.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through the console. The initial value is set to 20.
This variable interacts with other variables in the same context, such as MinLevelsetDimension, MinLevelsetSize, and LevelsetGhostCells. These variables work together to define the parameters of the level set used in the rigid clustering algorithm.
Developers must be aware that this variable directly affects the resolution of the level set grid used in physics simulations. A higher value will increase the precision of the simulation but at the cost of increased computational resources.
Best practices when using this variable include:
- Balancing between precision and performance by adjusting the value.
- Testing different values to find the optimal setting for your specific use case.
- Considering the interaction with other related variables, especially MinLevelsetDimension.
Regarding the associated variable MaxLevelsetDimension:
The purpose of MaxLevelsetDimension is the same as p.MaxLevelsetDimension, as they share the same value. It’s an internal variable used within the C++ code to store the console variable’s value.
This variable is used directly in the UpdateGeometry function of the PBDRigidClusteringAlgo, where it’s used to clamp the number of cells in each dimension of the level set grid.
Developers should be aware that changes to p.MaxLevelsetDimension will directly affect this variable, and vice versa. When working with the Chaos physics system, particularly with rigid body clustering, this variable plays a crucial role in determining the maximum resolution of the level set grid.
Best practices for MaxLevelsetDimension include:
- Ensuring that any direct modifications to this variable are also reflected in the console variable p.MaxLevelsetDimension for consistency.
- Considering the performance implications when increasing this value, as it directly affects the size of the level set grid.
- Balancing this value with MinLevelsetDimension to create an appropriate range for the level set resolution.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClusteringAlgo.cpp:22
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
int32 MaxLevelsetDimension = 20;
FAutoConsoleVariableRef CVarMaxLevelsetDimension2(TEXT("p.MaxLevelsetDimension"), MaxLevelsetDimension, TEXT("The maximum number of cells on a single level set axis"));
FRealSingle MinLevelsetSize = 50.f;
FAutoConsoleVariableRef CVarLevelSetResolution2(TEXT("p.MinLevelsetSize"), MinLevelsetSize, TEXT("The minimum size on the smallest axis to use a level set"));
int32 LevelsetGhostCells = 1;
FAutoConsoleVariableRef CVarLevelsetGhostCells2(TEXT("p.LevelsetGhostCells"), LevelsetGhostCells, TEXT("Increase the level set grid by this many ghost cells"));
#Associated Variable and Callsites
This variable is associated with another variable named MaxLevelsetDimension
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClusteringAlgo.cpp:21
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarMinLevelsetDimension2(TEXT("p.MinLevelsetDimension"), MinLevelsetDimension, TEXT("The minimum number of cells on a single level set axis"));
int32 MaxLevelsetDimension = 20;
FAutoConsoleVariableRef CVarMaxLevelsetDimension2(TEXT("p.MaxLevelsetDimension"), MaxLevelsetDimension, TEXT("The maximum number of cells on a single level set axis"));
FRealSingle MinLevelsetSize = 50.f;
FAutoConsoleVariableRef CVarLevelSetResolution2(TEXT("p.MinLevelsetSize"), MinLevelsetSize, TEXT("The minimum size on the smallest axis to use a level set"));
int32 LevelsetGhostCells = 1;
FAutoConsoleVariableRef CVarLevelsetGhostCells2(TEXT("p.LevelsetGhostCells"), LevelsetGhostCells, TEXT("Increase the level set grid by this many ghost cells"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClusteringAlgo.cpp:388
Scope (from outer to inner):
file
namespace Chaos
function void UpdateGeometry
Source code excerpt:
for (int i = 0; i < 3; ++i)
{
NumCells[i] = FMath::Clamp(NumCells[i], MinLevelsetDimension, MaxLevelsetDimension);
}
FErrorReporter ErrorReporter;
TUniformGrid<FReal, 3> Grid(Bounds.Min(), Bounds.Max(), NumCells, LevelsetGhostCells);
FLevelSet* LevelSet = new FLevelSet(ErrorReporter, Grid, UnionObject);