p.Chaos.XPBDBending.SplitLambdaDamping
p.Chaos.XPBDBending.SplitLambdaDamping
#Overview
name: p.Chaos.XPBDBending.SplitLambdaDamping
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Use the split two-pass damping model (slower but doesn\'t make cloth too soft at high damping levels).
It is referenced in 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.XPBDBending.SplitLambdaDamping is to control the damping model used in the XPBD (Extended Position Based Dynamics) bending constraints for cloth simulation in Unreal Engine’s Chaos physics system.
This setting variable is primarily used in the Chaos physics system, specifically in the cloth simulation module. It affects the behavior of bending constraints in cloth and other soft body simulations.
The value of this variable is set through a console variable (CVar) in non-shipping builds. In shipping builds, it’s set to a constant value of true.
The associated variable bChaos_XPBDBending_SplitLambdaDamping directly interacts with p.Chaos.XPBDBending.SplitLambdaDamping. They share the same value and purpose.
Developers must be aware that:
- This variable is only modifiable in non-shipping builds.
- It affects the performance and visual quality of cloth simulations.
- Enabling split lambda damping (true) is slower but provides better visual results at high damping levels.
Best practices when using this variable:
- Use the split damping model (true) for higher quality simulations, especially when high damping is required.
- Consider disabling it (false) for performance-critical scenarios where the visual difference is negligible.
- Test both options to find the best balance between performance and visual quality for your specific use case.
Regarding the associated variable bChaos_XPBDBending_SplitLambdaDamping:
- It’s used directly in the code to control the damping behavior.
- It’s defined in the Chaos::Softs namespace.
- In shipping builds, it’s set to a constant true value.
- In non-shipping builds, it can be modified through the console variable.
- It’s used in multiple locations within the XPBDBendingConstraints and XPBDAnisotropicBendingConstraints implementation to control the damping calculation method.
Developers should use this variable consistently across their codebase when working with XPBD bending constraints in the Chaos physics system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:26
Scope (from outer to inner):
file
namespace Chaos::Softs
Source code excerpt:
#if !UE_BUILD_SHIPPING
bool bChaos_XPBDBending_SplitLambdaDamping = true;
FAutoConsoleVariableRef CVarChaosXPBDBendingSplitLambdaDamping(TEXT("p.Chaos.XPBDBending.SplitLambdaDamping"), bChaos_XPBDBending_SplitLambdaDamping, TEXT("Use the split two-pass damping model (slower but doesn't make cloth too soft at high damping levels)."));
#endif
template<typename SolverParticlesOrRange>
void FXPBDBendingConstraints::InitColor(const SolverParticlesOrRange& InParticles)
{
// In dev builds we always color so we can tune the system without restarting. See Apply()
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_XPBDBending_SplitLambdaDamping
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDAnisotropicBendingConstraints.cpp:686
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDAnisotropicBendingConstraints::InitColor
function void FXPBDAnisotropicBendingConstraints::Apply
Source code excerpt:
if (DampingRatioValue > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
if (ColorSize >= Chaos_XPBDBending_ISPC_ParallelBatchSize * Chaos_XPBDBending_ISPC_MinNumParallelBatches)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDAnisotropicBendingConstraints.cpp:862
Scope (from outer to inner):
file
function void FXPBDAnisotropicBendingConstraints::InitColor
function void FXPBDAnisotropicBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
ispc::ApplyXPBDAnisotropicBendingDampingConstraintsWithMaps(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDAnisotropicBendingConstraints.cpp:1005
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDAnisotropicBendingConstraints::InitColor
function void FXPBDAnisotropicBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
PhysicsParallelFor(ColorSize, [&](const int32 Index)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDAnisotropicBendingConstraints.cpp:1088
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDAnisotropicBendingConstraints::InitColor
function void FXPBDAnisotropicBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintIndex = 0; ConstraintIndex < Constraints.Num(); ++ConstraintIndex)
{
const FSolverReal ExpStiffnessValue = StiffnessHasWeightMap ? StiffnessWarp[ConstraintIndex] : StiffnessNoMap;
const FSolverReal ExpStiffnessWeftValue = StiffnessWeftHasWeightMap ? StiffnessWeft[ConstraintIndex] : StiffnessWeftNoMap;
const FSolverReal ExpStiffnessBiasValue = StiffnessBiasHasWeightMap ? StiffnessBias[ConstraintIndex] : StiffnessBiasNoMap;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:25
Scope (from outer to inner):
file
namespace Chaos::Softs
Source code excerpt:
#if !UE_BUILD_SHIPPING
bool bChaos_XPBDBending_SplitLambdaDamping = true;
FAutoConsoleVariableRef CVarChaosXPBDBendingSplitLambdaDamping(TEXT("p.Chaos.XPBDBending.SplitLambdaDamping"), bChaos_XPBDBending_SplitLambdaDamping, TEXT("Use the split two-pass damping model (slower but doesn't make cloth too soft at high damping levels)."));
#endif
template<typename SolverParticlesOrRange>
void FXPBDBendingConstraints::InitColor(const SolverParticlesOrRange& InParticles)
{
// In dev builds we always color so we can tune the system without restarting. See Apply()
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:266
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDBendingConstraints::InitColor
function void FXPBDBendingConstraints::Apply
Source code excerpt:
if (DampingRatioValue > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
ispc::ApplyXPBDBendingDampingConstraints(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:344
Scope (from outer to inner):
file
function void FXPBDBendingConstraints::InitColor
function void FXPBDBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
ispc::ApplyXPBDBendingDampingConstraintsWithMaps(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:444
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDBendingConstraints::InitColor
function void FXPBDBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
{
const int32 ColorStart = ConstraintsPerColorStartIndex[ConstraintColorIndex];
const int32 ColorSize = ConstraintsPerColorStartIndex[ConstraintColorIndex + 1] - ColorStart;
PhysicsParallelFor(ColorSize, [&](const int32 Index)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/XPBDBendingConstraints.cpp:508
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FXPBDBendingConstraints::InitColor
function void FXPBDBendingConstraints::Apply
Source code excerpt:
if (DampingHasWeightMap || (FSolverReal)DampingRatio > 0)
{
if (bChaos_XPBDBending_SplitLambdaDamping)
{
for (int32 ConstraintIndex = 0; ConstraintIndex < Constraints.Num(); ++ConstraintIndex)
{
const FSolverReal ExpStiffnessValue = StiffnessHasWeightMap ? XPBDStiffness[ConstraintIndex] : StiffnessNoMap;
const FSolverReal ExpBucklingValue = BucklingStiffnessHasWeightMap ? XPBDBucklingStiffness[ConstraintIndex] : BucklingStiffnessNoMap;
const FSolverReal DampingRatioValue = DampingHasWeightMap ? DampingRatio[ConstraintIndex] : DampingNoMap;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/XPBDBendingConstraints.h:444
Scope (from outer to inner):
file
namespace Chaos::Softs
Source code excerpt:
// Support split vs shared damping models in non-shipping builds
#if UE_BUILD_SHIPPING
const bool bChaos_XPBDBending_SplitLambdaDamping = true;
#else
extern bool bChaos_XPBDBending_SplitLambdaDamping;
#endif
} // End namespace Chaos::Softs
// Support ISPC enable/disable in non-shipping builds
#if !INTEL_ISPC