p.ChaosCloth.Solver.ParallelClothPreUpdate
p.ChaosCloth.Solver.ParallelClothPreUpdate
#Overview
name: p.ChaosCloth.Solver.ParallelClothPreUpdate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Pre-transform the cloth particles for each cloth in parallel.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.ChaosCloth.Solver.ParallelClothPreUpdate is to control whether the pre-update transformation of cloth particles for each cloth is performed in parallel. This setting variable is part of the Chaos Cloth simulation system in Unreal Engine 5.
The Chaos Cloth simulation system, which is part of the ChaosCloth plugin, relies on this setting variable. It’s specifically used in the ChaosClothingSimulationSolver module.
The value of this variable is set through a console variable (CVar) system. It’s associated with the C++ boolean variable bClothSolverParallelClothPreUpdate, which is initialized to true by default.
This variable interacts closely with other parallel processing settings in the Chaos Cloth system, such as ParallelClothUpdate and ParallelClothPostUpdate. It also works in conjunction with the ClothSolverMinParallelBatchSize variable, which sets the minimum number of particles to process in a parallel batch.
Developers must be aware that enabling this setting can improve performance on multi-core systems by parallelizing the pre-update transformation of cloth particles. However, it may also introduce some overhead for thread management, so it’s not always beneficial for small cloth simulations.
Best practices when using this variable include:
- Enabling it for large cloth simulations with many particles.
- Considering the overall system performance and adjusting it along with other parallel processing settings.
- Testing the performance impact in your specific use case, as the benefits can vary depending on the complexity of the cloth simulation and the hardware.
Regarding the associated variable bClothSolverParallelClothPreUpdate:
The purpose of bClothSolverParallelClothPreUpdate is to internally represent the state of the p.ChaosCloth.Solver.ParallelClothPreUpdate console variable within the C++ code.
This variable is used directly in the ChaosClothingSimulationSolver to control the parallel execution of cloth pre-update operations. It’s referenced in several methods of the FClothingSimulationSolver class, such as ApplyPreSimulationTransforms() and PreSubstep().
The value of this variable is set through the console variable system and can be changed at runtime.
Developers should be aware that this variable directly affects the behavior of the cloth simulation solver. When set to true, it enables parallel processing for pre-update transformations, which can improve performance but may also affect the determinism of the simulation.
Best practices for using this variable include:
- Coordinating its use with other parallel processing flags in the Chaos Cloth system.
- Monitoring its impact on performance and simulation quality in your specific use cases.
- Consider exposing it as a configurable option in your game’s settings if cloth simulation performance is critical to your application.
#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:63
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarClothSolverMinParallelBatchSize(TEXT("p.ChaosCloth.Solver.MinParallelBatchSize"), ClothSolverMinParallelBatchSize, TEXT("The minimum number of particle to process in parallel batch by the solver."));
FAutoConsoleVariableRef CVarClothSolverParallelClothPreUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothPreUpdate"), bClothSolverParallelClothPreUpdate, TEXT("Pre-transform the cloth particles for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverParallelClothUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothUpdate"), bClothSolverParallelClothUpdate, TEXT("Skin the physics mesh and do the other cloth update for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverParallelClothPostUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothPostUpdate"), bClothSolverParallelClothPostUpdate, TEXT("Pre-transform the cloth particles for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverDebugHitchLength(TEXT("p.ChaosCloth.Solver.DebugHitchLength"), ClothSolverDebugHitchLength, TEXT("Hitch length in ms. Create artificial hitches to debug simulation jitter. 0 to disable"));
FAutoConsoleVariableRef CVarClothSolverDebugHitchInterval(TEXT("p.ChaosCloth.Solver.DebugHitchInterval"), ClothSolverDebugHitchInterval, TEXT("Hitch interval in frames. Create artificial hitches to debug simulation jitter. 0 to disable"));
FAutoConsoleVariableRef CVarClothSolverDisableCollision(TEXT("p.ChaosCloth.Solver.DisableCollision"), bClothSolverDisableCollision, TEXT("Disable all collision particles. Needs reset of the simulation (p.ChaosCloth.Reset)."));
#endif
#Associated Variable and Callsites
This variable is associated with another variable named bClothSolverParallelClothPreUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:50
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
static int32 ClothSolverMinParallelBatchSize = 1000;
static bool bClothSolverParallelClothPreUpdate = true;
static bool bClothSolverParallelClothUpdate = true;
static bool bClothSolverParallelClothPostUpdate = true;
static bool bClothSolverDisableTimeDependentNumIterations = false;
static bool bClothSolverUseVelocityScale = true;
static float ClothSolverMaxVelocity = 0.f;
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:63
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarClothSolverMinParallelBatchSize(TEXT("p.ChaosCloth.Solver.MinParallelBatchSize"), ClothSolverMinParallelBatchSize, TEXT("The minimum number of particle to process in parallel batch by the solver."));
FAutoConsoleVariableRef CVarClothSolverParallelClothPreUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothPreUpdate"), bClothSolverParallelClothPreUpdate, TEXT("Pre-transform the cloth particles for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverParallelClothUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothUpdate"), bClothSolverParallelClothUpdate, TEXT("Skin the physics mesh and do the other cloth update for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverParallelClothPostUpdate(TEXT("p.ChaosCloth.Solver.ParallelClothPostUpdate"), bClothSolverParallelClothPostUpdate, TEXT("Pre-transform the cloth particles for each cloth in parallel."));
FAutoConsoleVariableRef CVarClothSolverDebugHitchLength(TEXT("p.ChaosCloth.Solver.DebugHitchLength"), ClothSolverDebugHitchLength, TEXT("Hitch length in ms. Create artificial hitches to debug simulation jitter. 0 to disable"));
FAutoConsoleVariableRef CVarClothSolverDebugHitchInterval(TEXT("p.ChaosCloth.Solver.DebugHitchInterval"), ClothSolverDebugHitchInterval, TEXT("Hitch interval in frames. Create artificial hitches to debug simulation jitter. 0 to disable"));
FAutoConsoleVariableRef CVarClothSolverDisableCollision(TEXT("p.ChaosCloth.Solver.DisableCollision"), bClothSolverDisableCollision, TEXT("Disable all collision particles. Needs reset of the simulation (p.ChaosCloth.Reset)."));
#endif
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1596
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::ApplyPreSimulationTransforms
Source code excerpt:
}
}
}, /*bForceSingleThreaded =*/ !bClothSolverParallelClothPreUpdate);
}
else
{
const TPBDActiveView<Softs::FSolverParticles>& ParticlesActiveView = PBDEvolution->ParticlesActiveView();
const TArray<uint32>& ParticleGroupIds = PBDEvolution->ParticleGroupIds();
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1681
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::ApplyPreSimulationTransforms
Source code excerpt:
}, RangeSize < ClothSolverMinParallelBatchSize);
}
}, /*bForceSingleThreaded =*/ !bClothSolverParallelClothPreUpdate);
#if FRAMEPRO_ENABLED
FRAMEPRO_CUSTOM_STAT("ChaosClothSolverMinParallelBatchSize", ClothSolverMinParallelBatchSize, "ChaosClothSolver", "Particles", FRAMEPRO_COLOUR(128, 0, 255));
FRAMEPRO_CUSTOM_STAT("ChaosClothSolverParallelClothPreUpdate", bClothSolverParallelClothPreUpdate, "ChaosClothSolver", "Enabled", FRAMEPRO_COLOUR(128, 128, 64));
#endif
{
TRACE_CPUPROFILER_EVENT_SCOPE(FClothingSimulationSolver_CollisionPreSimulationTransforms);
SCOPE_CYCLE_COUNTER(STAT_ChaosClothCollisionPreSimulationTransforms);
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1761
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::PreSubstep
Source code excerpt:
}
}
}, /*bForceSingleThreaded =*/ !bClothSolverParallelClothPreUpdate);
{
TRACE_CPUPROFILER_EVENT_SCOPE(ChaosPBDClearCollidedArray);
memset(Collided.GetData(), 0, Collided.Num() * sizeof(bool));
}
CollisionContacts.Reset();
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationSolver.cpp:1810
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationSolver::PreSubstep
Source code excerpt:
}, RangeSize < ClothSolverMinParallelBatchSize);
}
}, /*bForceSingleThreaded =*/ !bClothSolverParallelClothPreUpdate);
}
}
void FClothingSimulationSolver::UpdateSolverField()
{
if ((Evolution || PBDEvolution) && !PerSolverField.IsEmpty())