p.Chaos.Solver.DebugDraw.ColorShapeByClientServer

p.Chaos.Solver.DebugDraw.ColorShapeByClientServer

#Overview

name: p.Chaos.Solver.DebugDraw.ColorShapeByClientServer

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Solver.DebugDraw.ColorShapeByClientServer is to enable a debug drawing feature in the Chaos physics solver that colors shapes differently based on whether they are on the client or server side in a networked game environment.

This setting variable is primarily used by the Chaos physics system, which is part of Unreal Engine’s experimental physics simulation module. Specifically, it’s utilized in the PBDRigidsSolver (Position Based Dynamics Rigid Bodies Solver) component of the Chaos system.

The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.

This variable interacts closely with several other debug drawing variables in the Chaos solver, such as ChaosSolverDebugDrawShowServer and ChaosSolverDebugDrawShowClient. It’s also associated with the ChaosSolverDebugDrawColorShapeByClientServer variable, which shares the same value.

Developers should be aware that this is a debug feature and should only be used during development or debugging sessions. It’s not intended for use in production builds. When enabled, it will impact performance due to the additional rendering overhead.

Best practices for using this variable include:

  1. Only enable it when specifically debugging client-server discrepancies in physics simulations.
  2. Use it in conjunction with other debug drawing options for a comprehensive view of the physics state.
  3. Remember to disable it before creating production builds.

Regarding the associated variable ChaosSolverDebugDrawColorShapeByClientServer:

The purpose of ChaosSolverDebugDrawColorShapeByClientServer is the same as p.Chaos.Solver.DebugDraw.ColorShapeByClientServer. It’s an internal representation of the console variable within the Chaos solver code.

This variable is used directly in the Chaos solver’s PostTickDebugDraw function to determine whether to apply client-server specific coloring to the debug shapes. When enabled, it causes the solver to use different color schemes for server-side and client-side physics objects.

The value of this variable is set by the console variable system, mirroring the value of p.Chaos.Solver.DebugDraw.ColorShapeByClientServer.

Developers should treat this variable as they would the console variable, being aware that modifying it will affect the debug visualization of the physics simulation. It’s primarily intended for internal use by the Chaos solver and should not be directly manipulated by game code.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverDrawMeshContacts(TEXT("p.Chaos.Solver.DebugDrawMeshContacts"), ChaosSolverDebugDrawMeshContacts, TEXT("Draw Mesh contacts"));
		FAutoConsoleVariableRef CVarChaosSolverDrawMeshBVHOverlaps(TEXT("p.Chaos.Solver.DebugDrawMeshBVHOverlaps"), ChaosSolverDebugDrawMeshBVHOverlaps, TEXT("Draw BVH of objects overlapping meshes"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawColorShapeByClientServer(TEXT("p.Chaos.Solver.DebugDraw.ColorShapeByClientServer"), ChaosSolverDebugDrawColorShapeByClientServer, TEXT("Color shape according to client and server: red = server / blue = client "));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawShowServer(TEXT("p.Chaos.Solver.DebugDraw.ShowServer"), ChaosSolverDebugDrawShowServer, TEXT("Draw server related debug data"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawShowClient(TEXT("p.Chaos.Solver.DebugDraw.ShowClient"), ChaosSolverDebugDrawShowClient, TEXT("Draw client related debug data"));

		int32 ChaosSolverDebugDrawPreIntegrationShapes = 0;
		int32 ChaosSolverDebugDrawPreIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPreIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPreIntegrationShapes"), ChaosSolverDebugDrawPreIntegrationShapes, TEXT("Draw Shapes prior to integrate."));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		int32 ChaosSolverDebugDrawMeshContacts = 0;
		int32 ChaosSolverDebugDrawMeshBVHOverlaps = 0;
		int32 ChaosSolverDebugDrawColorShapeByClientServer = 0;
		int32 ChaosSolverDebugDrawShowServer = 1;
		int32 ChaosSolverDebugDrawShowClient = 1;
		DebugDraw::FChaosDebugDrawJointFeatures ChaosSolverDrawJointFeatures = DebugDraw::FChaosDebugDrawJointFeatures::MakeDefault();
		FAutoConsoleVariableRef CVarChaosSolverDrawShapes(TEXT("p.Chaos.Solver.DebugDrawShapes"), ChaosSolverDebugDrawShapes, TEXT("Draw Shapes (0 = never; 1 = end of frame)."));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawMass(TEXT("p.Chaos.Solver.DebugDrawMass"), ChaosSolverDebugDrawMass, TEXT("Draw Mass values in Kg (0 = never; 1 = end of frame)."));
		FAutoConsoleVariableRef CVarChaosSolverDrawBVHs(TEXT("p.Chaos.Solver.DebugDrawBVHs"), ChaosSolverDebugDrawBVHs, TEXT("Draw Particle BVHs where applicable (0 = never; 1 = end of frame)."));

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverDrawMeshContacts(TEXT("p.Chaos.Solver.DebugDrawMeshContacts"), ChaosSolverDebugDrawMeshContacts, TEXT("Draw Mesh contacts"));
		FAutoConsoleVariableRef CVarChaosSolverDrawMeshBVHOverlaps(TEXT("p.Chaos.Solver.DebugDrawMeshBVHOverlaps"), ChaosSolverDebugDrawMeshBVHOverlaps, TEXT("Draw BVH of objects overlapping meshes"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawColorShapeByClientServer(TEXT("p.Chaos.Solver.DebugDraw.ColorShapeByClientServer"), ChaosSolverDebugDrawColorShapeByClientServer, TEXT("Color shape according to client and server: red = server / blue = client "));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawShowServer(TEXT("p.Chaos.Solver.DebugDraw.ShowServer"), ChaosSolverDebugDrawShowServer, TEXT("Draw server related debug data"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawShowClient(TEXT("p.Chaos.Solver.DebugDraw.ShowClient"), ChaosSolverDebugDrawShowClient, TEXT("Draw client related debug data"));

		int32 ChaosSolverDebugDrawPreIntegrationShapes = 0;
		int32 ChaosSolverDebugDrawPreIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPreIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPreIntegrationShapes"), ChaosSolverDebugDrawPreIntegrationShapes, TEXT("Draw Shapes prior to integrate."));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PostTickDebugDraw

Source code excerpt:

		if (ChaosSolverDebugDrawShapes == 1)
		{
			if (ChaosSolverDebugDrawColorShapeByClientServer)
			{
				if (bIsServer)
				{
					ChaosSolverDebugDebugDrawSettings.ShapesColorsPerState = GetSolverShapesColorsByState_Server();
				}
				else