p.Chaos.DebugDraw.MaxLines
p.Chaos.DebugDraw.MaxLines
#Overview
name: p.Chaos.DebugDraw.MaxLines
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set the maximum number of debug draw lines that can be rendered (to limit perf drops)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.DebugDraw.MaxLines is to set the maximum number of debug draw lines that can be rendered for the Chaos physics system in Unreal Engine 5. This setting is specifically for debugging and visualization purposes within the Chaos physics solver.
This setting variable is primarily used by the Chaos physics subsystem, which is part of the experimental ChaosSolverEngine module in Unreal Engine 5. It’s utilized in the debug drawing functionality of the Chaos physics system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The associated variable ChaosDebugDraw_MaxElements directly interacts with p.Chaos.DebugDraw.MaxLines. They share the same value and purpose, with ChaosDebugDraw_MaxElements being the actual integer variable used in the code.
Developers must be aware that this variable directly impacts performance and memory usage. Setting it too high might cause performance drops, especially in complex scenes with many physics objects.
Best practices when using this variable include:
- Keep the value reasonably low in production builds to avoid performance issues.
- Adjust the value based on the complexity of your scene and the number of physics objects you need to debug.
- Use in conjunction with other Chaos debug draw settings like p.Chaos.DebugDraw.Radius for more controlled debugging.
Regarding the associated variable ChaosDebugDraw_MaxElements: The purpose of ChaosDebugDraw_MaxElements is identical to p.Chaos.DebugDraw.MaxLines. It’s the actual integer variable that stores the maximum number of debug draw elements.
This variable is used directly in the UChaosDebugDrawComponent::TickComponent and UChaosDebugDrawComponent::CreateDebugDrawActor functions to set the maximum cost (number of elements) for the debug draw queue.
The value of ChaosDebugDraw_MaxElements is set through the console variable system, just like p.Chaos.DebugDraw.MaxLines.
Developers should treat ChaosDebugDraw_MaxElements as the internal representation of p.Chaos.DebugDraw.MaxLines. When working with the Chaos debug draw system in code, they would use ChaosDebugDraw_MaxElements directly.
Best practices for ChaosDebugDraw_MaxElements are the same as for p.Chaos.DebugDraw.MaxLines, focusing on balancing between debug visibility and performance impact.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:28
Scope: file
Source code excerpt:
int ChaosDebugDraw_MaxElements = 20000;
FAutoConsoleVariableRef CVarChaos_DebugDraw_MaxElements(TEXT("p.Chaos.DebugDraw.MaxLines"), ChaosDebugDraw_MaxElements, TEXT("Set the maximum number of debug draw lines that can be rendered (to limit perf drops)"));
float ChaosDebugDraw_Radius = 3000.0f;
FAutoConsoleVariableRef CVarChaos_DebugDraw_Radius(TEXT("p.Chaos.DebugDraw.Radius"), ChaosDebugDraw_Radius, TEXT("Set the radius from the camera where debug draw capture stops (0 means infinite)"));
bool ChaosDebugDraw_SeeThrough = true;
FAutoConsoleVariableRef CVarChaos_DebugDraw_SeeThrough(TEXT("p.Chaos.DebugDraw.SeeThrough"), ChaosDebugDraw_SeeThrough, TEXT("When enabled , lines will be drawn on top of all geometry"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosDebugDraw_MaxElements
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:27
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarChaos_DebugDraw_Enabled(TEXT("p.Chaos.DebugDraw.Enabled"), bChaosDebugDraw_Enabled, TEXT("Whether to debug draw low level physics solver information"), FConsoleVariableDelegate::CreateStatic(ChaosDebugDraw_Enabled_Changed));
int ChaosDebugDraw_MaxElements = 20000;
FAutoConsoleVariableRef CVarChaos_DebugDraw_MaxElements(TEXT("p.Chaos.DebugDraw.MaxLines"), ChaosDebugDraw_MaxElements, TEXT("Set the maximum number of debug draw lines that can be rendered (to limit perf drops)"));
float ChaosDebugDraw_Radius = 3000.0f;
FAutoConsoleVariableRef CVarChaos_DebugDraw_Radius(TEXT("p.Chaos.DebugDraw.Radius"), ChaosDebugDraw_Radius, TEXT("Set the radius from the camera where debug draw capture stops (0 means infinite)"));
bool ChaosDebugDraw_SeeThrough = true;
FAutoConsoleVariableRef CVarChaos_DebugDraw_SeeThrough(TEXT("p.Chaos.DebugDraw.SeeThrough"), ChaosDebugDraw_SeeThrough, TEXT("When enabled , lines will be drawn on top of all geometry"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:325
Scope (from outer to inner):
file
function void UChaosDebugDrawComponent::TickComponent
Source code excerpt:
}
FDebugDrawQueue::GetInstance().SetMaxCost(ChaosDebugDraw_MaxElements);
const bool bIsPaused = World->IsPaused();
if (!bIsPaused)
{
FDebugDrawQueue::GetInstance().ExtractAllElements(DrawCommands);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:393
Scope (from outer to inner):
file
function void UChaosDebugDrawComponent::CreateDebugDrawActor
Source code excerpt:
// SetMaxCommands and SetRegionOfInterest here so that the first frame gets whatever cvar value we have set.
// We also call it every tick (which is at the end of each frame)
Chaos::FDebugDrawQueue::GetInstance().SetMaxCost(ChaosDebugDraw_MaxElements);
Chaos::FDebugDrawQueue::GetInstance().SetRegionOfInterest(FVector::ZeroVector, ChaosDebugDraw_Radius);
#endif
}