p.Chaos.Solver.Joint.MinSolverStiffness

p.Chaos.Solver.Joint.MinSolverStiffness

#Overview

name: p.Chaos.Solver.Joint.MinSolverStiffness

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Solver.Joint.MinSolverStiffness is to set the initial solver stiffness for joint constraints in the Chaos physics system of Unreal Engine 5. It specifically controls the stiffness value used on the first iteration of the joint solver, which then increases with each subsequent iteration towards the MaxSolverStiffness value.

This setting variable is primarily used by the Chaos physics subsystem, specifically within the joint solver component. It’s part of the Experimental Chaos module in Unreal Engine 5.

The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 1.0f in the C++ code.

This variable interacts closely with several other joint-related variables, particularly:

  1. p.Chaos.Solver.Joint.MaxSolverStiffness
  2. p.Chaos.Solver.Joint.NumIterationsAtMaxSolverStiffness

These variables work together to control how the joint solver stiffness changes over iterations.

Developers should be aware that this variable affects the behavior of joint constraints in physics simulations. A lower value will result in softer, more compliant joints on the first iteration, while a higher value will make joints more rigid from the start.

Best practices when using this variable include:

  1. Balancing it with MaxSolverStiffness to achieve desired joint behavior.
  2. Considering the performance implications of the stiffness progression over iterations.
  3. Testing different values to find the optimal balance between stability and performance for specific use cases.

Regarding the associated variable ChaosSolverJointMinSolverStiffness:

This is the actual float variable that stores the value set by the p.Chaos.Solver.Joint.MinSolverStiffness console variable. It’s used directly in the physics solver code to apply the minimum stiffness setting to joint constraints.

The value of ChaosSolverJointMinSolverStiffness is initially set to 1.0f and can be modified at runtime through the console variable system. It’s used in the PrepareAdvanceBy function of the FPBDRigidsSolver class to configure the joint solver settings before each physics step.

Developers should note that changes to this variable will directly affect the physics simulation, potentially impacting both the visual results and performance of the physics system. It’s important to adjust this value carefully and in conjunction with related joint solver settings to achieve the desired balance of accuracy and performance.

#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:392

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		int32 ChaosSolverJointNumShockProagationIterations = 0;
		FRealSingle ChaosSolverJointShockPropagation = -1.0f;
		FAutoConsoleVariableRef CVarChaosSolverJointMinSolverStiffness(TEXT("p.Chaos.Solver.Joint.MinSolverStiffness"), ChaosSolverJointMinSolverStiffness, TEXT("Solver stiffness on first iteration, increases each iteration toward MaxSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.MaxSolverStiffness"), ChaosSolverJointMaxSolverStiffness, TEXT("Solver stiffness on last iteration, increases each iteration from MinSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointNumIterationsAtMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.NumIterationsAtMaxSolverStiffness"), ChaosSolverJointNumIterationsAtMaxSolverStiffness, TEXT("How many iterations we want at MaxSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointSolvePositionFirst(TEXT("p.Chaos.Solver.Joint.SolvePositionLast"), bChaosSolverJointSolvePositionLast, TEXT("Should we solve joints in position-then-rotation order (false) or rotation-then-position order (true, default)"));
		FAutoConsoleVariableRef CVarChaosSolverJointUsePBDVelocityDrives(TEXT("p.Chaos.Solver.Joint.UsePBDDrives"), bChaosSolverJointUsePositionBasedDrives, TEXT("Whether to solve drives in the position or velocity phase of the solver (default true"));
		FAutoConsoleVariableRef CVarChaosSolverJointNumShockPropagationIterations(TEXT("p.Chaos.Solver.Joint.NumShockPropagationIterations"), ChaosSolverJointNumShockProagationIterations, TEXT("How many iterations to enable SHockProagation for."));
		FAutoConsoleVariableRef CVarChaosSolverJointShockPropagation(TEXT("p.Chaos.Solver.Joint.ShockPropagation"), ChaosSolverJointShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));

#Associated Variable and Callsites

This variable is associated with another variable named ChaosSolverJointMinSolverStiffness. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:385

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		// Joint cvars
		float ChaosSolverJointMinSolverStiffness = 1.0f;
		float ChaosSolverJointMaxSolverStiffness = 1.0f;
		int32 ChaosSolverJointNumIterationsAtMaxSolverStiffness = 1;
		bool bChaosSolverJointSolvePositionLast = true;
		bool bChaosSolverJointUsePositionBasedDrives = true;
		int32 ChaosSolverJointNumShockProagationIterations = 0;
		FRealSingle ChaosSolverJointShockPropagation = -1.0f;
		FAutoConsoleVariableRef CVarChaosSolverJointMinSolverStiffness(TEXT("p.Chaos.Solver.Joint.MinSolverStiffness"), ChaosSolverJointMinSolverStiffness, TEXT("Solver stiffness on first iteration, increases each iteration toward MaxSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.MaxSolverStiffness"), ChaosSolverJointMaxSolverStiffness, TEXT("Solver stiffness on last iteration, increases each iteration from MinSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointNumIterationsAtMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.NumIterationsAtMaxSolverStiffness"), ChaosSolverJointNumIterationsAtMaxSolverStiffness, TEXT("How many iterations we want at MaxSolverStiffness."));
		FAutoConsoleVariableRef CVarChaosSolverJointSolvePositionFirst(TEXT("p.Chaos.Solver.Joint.SolvePositionLast"), bChaosSolverJointSolvePositionLast, TEXT("Should we solve joints in position-then-rotation order (false) or rotation-then-position order (true, default)"));
		FAutoConsoleVariableRef CVarChaosSolverJointUsePBDVelocityDrives(TEXT("p.Chaos.Solver.Joint.UsePBDDrives"), bChaosSolverJointUsePositionBasedDrives, TEXT("Whether to solve drives in the position or velocity phase of the solver (default true"));
		FAutoConsoleVariableRef CVarChaosSolverJointNumShockPropagationIterations(TEXT("p.Chaos.Solver.Joint.NumShockPropagationIterations"), ChaosSolverJointNumShockProagationIterations, TEXT("How many iterations to enable SHockProagation for."));
		FAutoConsoleVariableRef CVarChaosSolverJointShockPropagation(TEXT("p.Chaos.Solver.Joint.ShockPropagation"), ChaosSolverJointShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1292

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PrepareAdvanceBy

Source code excerpt:

		
		FPBDJointSolverSettings JointsSettings = MEvolution->GetJointConstraints().GetSettings();
		JointsSettings.MinSolverStiffness = ChaosSolverJointMinSolverStiffness;
		JointsSettings.MaxSolverStiffness = ChaosSolverJointMaxSolverStiffness;
		JointsSettings.NumIterationsAtMaxSolverStiffness = ChaosSolverJointNumIterationsAtMaxSolverStiffness;
		JointsSettings.PositionTolerance = ChaosSolverJointPositionTolerance;
		JointsSettings.AngleTolerance = ChaosSolverJointAngleTolerance;
		JointsSettings.MinParentMassRatio = ChaosSolverJointMinParentMassRatio;
		JointsSettings.MaxInertiaRatio = ChaosSolverJointMaxInertiaRatio;