p.ChaosCloth.Solver.DisableTimeDependentNumIterations
p.ChaosCloth.Solver.DisableTimeDependentNumIterations
#Overview
name: p.ChaosCloth.Solver.DisableTimeDependentNumIterations
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Make the number of iterations independent from the time step.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.ChaosCloth.Solver.DisableTimeDependentNumIterations is to control whether the number of iterations in the Chaos Cloth solver should be independent of the time step or not. This setting variable is part of the cloth simulation system in Unreal Engine 5, specifically for the Chaos physics engine.
This setting variable is used in the Chaos Cloth plugin, which is part of the physics simulation system in Unreal Engine 5. The main subsystem that relies on this variable is the cloth simulation solver within the Chaos physics engine.
The value of this variable is set through a console variable (CVar) system. It’s defined using FAutoConsoleVariableRef, which allows it to be changed at runtime through console commands or configuration files.
The associated variable bClothSolverDisableTimeDependentNumIterations interacts directly with p.ChaosCloth.Solver.DisableTimeDependentNumIterations. They share the same value, with the console variable controlling the boolean flag.
Developers must be aware that this variable affects the behavior of the cloth simulation solver. When set to true, it makes the number of iterations in the solver independent of the time step, which can impact the simulation’s accuracy and performance.
Best practices when using this variable include:
- Understanding the trade-offs between performance and accuracy when changing this setting.
- Testing the cloth simulation with both enabled and disabled states to determine which works best for your specific use case.
- Considering the impact on frame rate and overall game performance, especially in scenes with multiple cloth simulations.
Regarding the associated variable bClothSolverDisableTimeDependentNumIterations:
- Its purpose is to store the actual boolean value that determines whether time-dependent iterations are disabled.
- It’s used directly in the FClothingSimulationSolver::Update function to determine how the number of iterations is calculated.
- The value is set by the console variable system and can be changed at runtime.
- It interacts with other variables like ConfigNumIterations and SolverFrequency to determine the final number of iterations.
- Developers should be aware that changing this variable can significantly affect the behavior and performance of the cloth simulation.
- Best practices include monitoring performance metrics when adjusting this value and ensuring it aligns with the desired visual quality and performance goals of the project.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:71
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
#endif
FAutoConsoleVariableRef CVarClothSolverDisableTimeDependentNumIterations(TEXT("p.ChaosCloth.Solver.DisableTimeDependentNumIterations"), bClothSolverDisableTimeDependentNumIterations, TEXT("Make the number of iterations independent from the time step."));
FAutoConsoleVariableRef CVarClothSolverUseVelocityScale(TEXT("p.ChaosCloth.Solver.UseVelocityScale"), bClothSolverUseVelocityScale, TEXT("Use the velocity scale to compensate for clamping to MaxPhysicsDelta, in order to avoid miscalculating velocities during hitches."));
FAutoConsoleVariableRef CVarClothSolverMaxVelocity(TEXT("p.ChaosCloth.Solver.MaxVelocity"), ClothSolverMaxVelocity, TEXT("Maximum relative velocity of the cloth particles relatively to their animated positions equivalent. 0 to disable."));
namespace ClothingSimulationSolverDefault
{
static const Softs::FSolverVec3 Gravity((Softs::FSolverReal)0., (Softs::FSolverReal)0., (Softs::FSolverReal)-980.665); // cm/s^2
#Associated Variable and Callsites
This variable is associated with another variable named bClothSolverDisableTimeDependentNumIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:53
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
static bool bClothSolverParallelClothUpdate = true;
static bool bClothSolverParallelClothPostUpdate = true;
static bool bClothSolverDisableTimeDependentNumIterations = false;
static bool bClothSolverUseVelocityScale = true;
static float ClothSolverMaxVelocity = 0.f;
#if !UE_BUILD_SHIPPING
static int32 ClothSolverDebugHitchLength = 0;
static int32 ClothSolverDebugHitchInterval = 0;
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:71
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
#endif
FAutoConsoleVariableRef CVarClothSolverDisableTimeDependentNumIterations(TEXT("p.ChaosCloth.Solver.DisableTimeDependentNumIterations"), bClothSolverDisableTimeDependentNumIterations, TEXT("Make the number of iterations independent from the time step."));
FAutoConsoleVariableRef CVarClothSolverUseVelocityScale(TEXT("p.ChaosCloth.Solver.UseVelocityScale"), bClothSolverUseVelocityScale, TEXT("Use the velocity scale to compensate for clamping to MaxPhysicsDelta, in order to avoid miscalculating velocities during hitches."));
FAutoConsoleVariableRef CVarClothSolverMaxVelocity(TEXT("p.ChaosCloth.Solver.MaxVelocity"), ClothSolverMaxVelocity, TEXT("Maximum relative velocity of the cloth particles relatively to their animated positions equivalent. 0 to disable."));
namespace ClothingSimulationSolverDefault
{
static const Softs::FSolverVec3 Gravity((Softs::FSolverReal)0., (Softs::FSolverReal)0., (Softs::FSolverReal)-980.665); // cm/s^2
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1979
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::Update
Source code excerpt:
{
Evolution->SetSolverProperties(Properties);
Evolution->SetDisableTimeDependentNumIterations(bClothSolverDisableTimeDependentNumIterations);
}
else
{
const int32 ConfigMaxNumIterations = FMath::Max(
Properties.GetValue<int32>(TEXT("MaxNumIterations"), ClothingSimulationSolverDefault::MaxNumIterations),
ClothingSimulationSolverDefault::MinNumIterations);
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1995
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::Update
Source code excerpt:
const Softs::FSolverReal SolverFrequency = (Softs::FSolverReal)ClothingSimulationSolverDefault::SolverFrequency; // 60Hz default TODO: Should this become a solver property?
const int32 TimeDependentNumIterations = bClothSolverDisableTimeDependentNumIterations ?
ConfigNumIterations :
FMath::RoundToInt32(SolverFrequency * DeltaTime * (Softs::FSolverReal)ConfigNumIterations);
PBDEvolution->SetIterations(FMath::Clamp(TimeDependentNumIterations, 1, ConfigMaxNumIterations));
}