p.Chaos.PBDEvolution.FastPositionBasedFriction
p.Chaos.PBDEvolution.FastPositionBasedFriction
#Overview
name: p.Chaos.PBDEvolution.FastPositionBasedFriction
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDEvolution.FastPositionBasedFriction is to control the use of a fast position-based friction calculation method in the Chaos physics engine’s Position-Based Dynamics (PBD) evolution system.
This setting variable is primarily used by the Chaos physics engine, which is an experimental physics simulation system in Unreal Engine 5. Specifically, it’s used within the PBD Evolution module, which is responsible for simulating the motion and interactions of particles in a physics-based system.
The value of this variable is set as a console variable (CVar) in the Unreal Engine. It’s defined as a boolean value and is initialized to true by default. This means that the fast position-based friction calculation is enabled by default.
The associated variable CVarChaosPBDEvolutionFastPositionBasedFriction directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the performance and potentially the accuracy of friction calculations in the PBD system. When set to true, it uses a faster method for calculating friction, which may be less accurate but more performant.
Best practices when using this variable include:
- Testing the simulation with both true and false values to understand the impact on your specific use case.
- Considering the trade-off between performance and accuracy. If precise friction calculations are crucial for your simulation, you might want to set this to false.
- Being cautious when changing this value during runtime, as it could lead to inconsistent behavior in ongoing simulations.
Regarding the associated variable CVarChaosPBDEvolutionFastPositionBasedFriction:
This is the actual CVar that controls the behavior in the code. It’s used in conditional statements to determine whether to use the fast position-based friction calculation or not. For example, in the provided code snippet, when this variable is false and the coefficient of friction is greater than 0, a different (presumably more accurate but slower) friction calculation method is used.
Developers should use this CVar when they need to programmatically check or change the fast position-based friction setting in their code. They can access its value using the GetValueOnAnyThread() method, as shown in the code example.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:33
Scope: file
Source code excerpt:
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseNestedParallelFor(TEXT("p.Chaos.PBDEvolution.UseNestedParallelFor"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionFastPositionBasedFriction(TEXT("p.Chaos.PBDEvolution.FastPositionBasedFriction"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseSmoothTimeStep(TEXT("p.Chaos.PBDEvolution.UseSmoothTimeStep"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
#Associated Variable and Callsites
This variable is associated with another variable named CVarChaosPBDEvolutionFastPositionBasedFriction
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:33
Scope: file
Source code excerpt:
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseNestedParallelFor(TEXT("p.Chaos.PBDEvolution.UseNestedParallelFor"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionFastPositionBasedFriction(TEXT("p.Chaos.PBDEvolution.FastPositionBasedFriction"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseSmoothTimeStep(TEXT("p.Chaos.PBDEvolution.UseSmoothTimeStep"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:704
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDEvolution::AdvanceOneTimeStep
Source code excerpt:
// The following is not currently been used by the cloth solver implementation at the moment
if (!CVarChaosPBDEvolutionFastPositionBasedFriction.GetValueOnAnyThread() && MCoefficientOfFriction > 0)
{
SCOPE_CYCLE_COUNTER(STAT_ChaosPBDCollisionRuleFriction);
MParticlesActiveView.ParallelFor(
[&CollisionRule, Dt](FSolverParticles& Particles, int32 Index)
{
TRACE_CPUPROFILER_EVENT_SCOPE(ChaosPBDCollisionRuleFriction);