p.LogDirtyParticles
p.LogDirtyParticles
#Overview
name: p.LogDirtyParticles
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Logs out which particles are dirty every frame
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.LogDirtyParticles is to enable logging of which particles are marked as dirty in the physics simulation every frame. This setting variable is primarily used for debugging and performance analysis in the Chaos physics engine of Unreal Engine 5.
This setting variable is utilized by the Chaos physics subsystem, specifically within the PBDRigidsSolver component. The Chaos physics engine is an experimental module in Unreal Engine 5 that handles physics simulations.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through the console. It is initialized to 0 by default, meaning the logging is disabled.
The associated variable LogDirtyParticles interacts directly with p.LogDirtyParticles. They share the same value, with LogDirtyParticles being the actual integer variable used in the code logic.
Developers must be aware that enabling this logging can have performance implications, especially in scenes with many physics objects. It should primarily be used for debugging purposes and not in production builds.
Best practices when using this variable include:
- Only enable it when necessary for debugging or performance analysis.
- Disable it in production builds to avoid unnecessary performance overhead.
- Be prepared for potentially large log outputs when enabled in complex scenes.
- Use it in conjunction with other debugging tools to get a comprehensive understanding of the physics simulation state.
Regarding the associated variable LogDirtyParticles:
The purpose of LogDirtyParticles is to serve as the actual integer variable that controls the logging behavior within the code. It is directly linked to the console variable p.LogDirtyParticles.
This variable is used within the Chaos physics subsystem, specifically in the FPBDRigidsSolver class, which is part of the particle-based dynamics solver in the Chaos engine.
The value of LogDirtyParticles is set through the console variable p.LogDirtyParticles, allowing for dynamic control during runtime.
LogDirtyParticles interacts with the logging system of Unreal Engine. When its value is non-zero, it triggers the logging of dirty particles information.
Developers should be aware that this variable directly affects the behavior of the physics solver and can impact performance when enabled.
Best practices for using LogDirtyParticles include:
- Use it sparingly and only when investigating specific physics-related issues.
- Remember to disable it after debugging to prevent unnecessary performance overhead.
- Consider wrapping the logging code in preprocessor directives for shipping builds to ensure it’s completely removed in release versions.
#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:1413
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
int32 LogDirtyParticles = 0;
FAutoConsoleVariableRef CVarLogDirtyParticles(TEXT("p.LogDirtyParticles"), LogDirtyParticles, TEXT("Logs out which particles are dirty every frame"));
void FPBDRigidsSolver::PushPhysicsState(const FReal DeltaTime, const int32 NumSteps, const int32 NumExternalSteps)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_PushPhysicsState);
ensure(NumSteps > 0);
ensure(NumExternalSteps > 0);
#Associated Variable and Callsites
This variable is associated with another variable named LogDirtyParticles
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1412
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
int32 LogDirtyParticles = 0;
FAutoConsoleVariableRef CVarLogDirtyParticles(TEXT("p.LogDirtyParticles"), LogDirtyParticles, TEXT("Logs out which particles are dirty every frame"));
void FPBDRigidsSolver::PushPhysicsState(const FReal DeltaTime, const int32 NumSteps, const int32 NumExternalSteps)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_PushPhysicsState);
ensure(NumSteps > 0);
ensure(NumExternalSteps > 0);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1493
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PushPhysicsState
Source code excerpt:
});
if(!!LogDirtyParticles)
{
int32 NumJoints = 0;
int32 NumSuspension = 0;
int32 NumCharacterGroundConstraints = 0;
int32 NumParticles = 0;
UE_LOG(LogChaos, Warning, TEXT("LogDirtyParticles:"));