p.Chaos.Solver.Iterations.Projection
p.Chaos.Solver.Iterations.Projection
#Overview
name: p.Chaos.Solver.Iterations.Projection
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override number of solver projection iterations (-1 to use config)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Iterations.Projection is to control the number of projection iterations in the Chaos physics solver within Unreal Engine 5. This setting is specifically related to the physics simulation system, particularly the Chaos solver used for rigid body dynamics.
This setting variable is primarily used by the Chaos physics module in Unreal Engine 5. It’s part of the experimental Chaos physics system, which is a more advanced physics simulation engine compared to the older PhysX system.
The value of this variable is set through a console variable (CVar) system. It can be set in-game or through configuration files. The default value is -1, which means it will use the value from the configuration files. Any non-negative value will override the config setting.
The associated variable ChaosSolverProjectionIterations directly interacts with p.Chaos.Solver.Iterations.Projection. They share the same value, with ChaosSolverProjectionIterations being the actual variable used in the code to store and apply the setting.
Developers must be aware that:
- This variable affects the accuracy and performance of the physics simulation.
- Higher values will increase accuracy but also increase computational cost.
- The setting can be dynamically changed during runtime, allowing for performance tuning.
Best practices when using this variable include:
- Start with the default configuration and only adjust if necessary.
- Monitor performance impacts when changing this value.
- Consider different values for different scenarios (e.g., more iterations for detailed simulations, fewer for performance-critical scenes).
- Use in conjunction with other Chaos solver settings for optimal results.
Regarding the associated variable ChaosSolverProjectionIterations:
- It’s the actual integer variable that stores the number of projection iterations.
- It’s used directly in the FPBDRigidsSolver::PrepareAdvanceBy function to set the projection iterations for the solver.
- Like the CVar, a value of -1 means to use the config setting, while any non-negative value will override it.
- It allows for runtime adjustment of the projection iterations, which can be useful for dynamic performance tuning or adapting to different simulation scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:316
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverProjectionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverProjectionIterations(TEXT("p.Chaos.Solver.Iterations.Projection"), ChaosSolverProjectionIterations, TEXT("Override number of solver projection iterations (-1 to use config)"));
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
// Copied from RBAN
FRealSingle ChaosSolverJointPositionTolerance = 0.025f;
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverProjectionIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:315
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverPushOutIterations(TEXT("p.Chaos.Solver.Iterations.Velocity"), ChaosSolverVelocityIterations, TEXT("Override number of solver velocity iterations (-1 to use config)"));
int32 ChaosSolverProjectionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverProjectionIterations(TEXT("p.Chaos.Solver.Iterations.Projection"), ChaosSolverProjectionIterations, TEXT("Override number of solver projection iterations (-1 to use config)"));
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
// Copied from RBAN
FRealSingle ChaosSolverJointPositionTolerance = 0.025f;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1336
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
SetVelocityIterations(ChaosSolverVelocityIterations);
}
if (ChaosSolverProjectionIterations >= 0)
{
SetProjectionIterations(ChaosSolverProjectionIterations);
}
if (ChaosSolverCullDistance >= 0.0f)
{
SetCollisionCullDistance(ChaosSolverCullDistance);
}
if ((ChaosSolverVelocityBoundsMultiplier >= 0.0f) && (ChaosSolverMaxVelocityBoundsExpansion >= 0.0f))