p.UseBoundingBoxForConnectionGraphFiltering

p.UseBoundingBoxForConnectionGraphFiltering

#Overview

name: p.UseBoundingBoxForConnectionGraphFiltering

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.UseBoundingBoxForConnectionGraphFiltering is to control whether bounding box overlaps are used to filter connections during the connection graph generation in Unreal Engine’s Chaos physics system.

This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics simulation module. It’s specifically utilized in the rigid clustering functionality of the physics system.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 (off) by default, but can be changed at runtime or through configuration files.

This variable interacts closely with another variable called BoundingBoxMarginForConnectionGraphFiltering. When UseBoundingBoxForConnectionGraphFiltering is enabled, BoundingBoxMarginForConnectionGraphFiltering determines the margin used for the overlap test.

Developers must be aware that enabling this feature may impact performance and the behavior of the physics simulation, particularly in how rigid body clusters are formed and interact. It’s important to test thoroughly when enabling this feature to ensure it doesn’t negatively impact the desired physics behavior in the game.

Best practices when using this variable include:

  1. Only enable it if you need more precise control over connection graph generation.
  2. If enabled, carefully tune the BoundingBoxMarginForConnectionGraphFiltering value to achieve the desired balance between performance and accuracy.
  3. Profile the performance impact when enabling this feature, especially in scenes with many rigid body clusters.

Regarding the associated variable BoundingBoxMarginForConnectionGraphFiltering:

The purpose of BoundingBoxMarginForConnectionGraphFiltering is to define the margin used for the bounding box overlap test when UseBoundingBoxForConnectionGraphFiltering is enabled.

This variable is also part of the Chaos physics subsystem and is closely tied to the connection graph generation process for rigid body clustering.

The value is set through the CVar system and initialized to 0 by default. It’s used when UseBoundingBoxForConnectionGraphFiltering is enabled.

Developers should be aware that this value directly affects how connections are determined in the physics simulation. A larger margin may result in more connections, potentially impacting performance and simulation accuracy.

Best practices for this variable include:

  1. Start with a small non-zero value and gradually increase it while monitoring performance and simulation behavior.
  2. Consider the scale of your physics objects when setting this value.
  3. Test with various scenarios to ensure the chosen value works well across different use cases in your game.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:52

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:


	int32 UseBoundingBoxForConnectionGraphFiltering = 0;
	FAutoConsoleVariableRef CVarUseBoundingBoxForConnectionGraphFiltering(TEXT("p.UseBoundingBoxForConnectionGraphFiltering"), UseBoundingBoxForConnectionGraphFiltering, TEXT("when on, use bounding box overlaps to filter connection during the connection graph generation [def: 0]"));

	float BoundingBoxMarginForConnectionGraphFiltering = 0;
	FAutoConsoleVariableRef CVarBoundingBoxMarginForConnectionGraphFiltering(TEXT("p.BoundingBoxMarginForConnectionGraphFiltering"), BoundingBoxMarginForConnectionGraphFiltering, TEXT("when UseBoundingBoxForConnectionGraphFiltering is on, the margin to use for the oevrlap test [def: 0]"));

	int32 GraphPropagationBasedCollisionImpulseProcessing = 0;
	FAutoConsoleVariableRef CVarGraphPropagationBasedCollisionImpulseProcessing(TEXT("p.GraphPropagationBasedCollisionImpulseProcessing"), GraphPropagationBasedCollisionImpulseProcessing, TEXT("when processing collision impulse toc ompute strain, pick the closest child from the impact point and propagate using the connection graph [def: 0]"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:51

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	FAutoConsoleVariableRef CVarDeactivateClusterChildren(TEXT("p.DeactivateClusterChildren"), DeactivateClusterChildren, TEXT("If children should be decativated when broken and put into another cluster."));

	int32 UseBoundingBoxForConnectionGraphFiltering = 0;
	FAutoConsoleVariableRef CVarUseBoundingBoxForConnectionGraphFiltering(TEXT("p.UseBoundingBoxForConnectionGraphFiltering"), UseBoundingBoxForConnectionGraphFiltering, TEXT("when on, use bounding box overlaps to filter connection during the connection graph generation [def: 0]"));

	float BoundingBoxMarginForConnectionGraphFiltering = 0;
	FAutoConsoleVariableRef CVarBoundingBoxMarginForConnectionGraphFiltering(TEXT("p.BoundingBoxMarginForConnectionGraphFiltering"), BoundingBoxMarginForConnectionGraphFiltering, TEXT("when UseBoundingBoxForConnectionGraphFiltering is on, the margin to use for the oevrlap test [def: 0]"));

	int32 GraphPropagationBasedCollisionImpulseProcessing = 0;
	FAutoConsoleVariableRef CVarGraphPropagationBasedCollisionImpulseProcessing(TEXT("p.GraphPropagationBasedCollisionImpulseProcessing"), GraphPropagationBasedCollisionImpulseProcessing, TEXT("when processing collision impulse toc ompute strain, pick the closest child from the impact point and propagate using the connection graph [def: 0]"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:3004

Scope (from outer to inner):

file
namespace    Chaos
function     void FRigidClustering::UpdateConnectivityGraphUsingDelaunayTriangulation

Source code excerpt:

		SCOPE_CYCLE_COUNTER(STAT_UpdateConnectivityGraphUsingDelaunayTriangulation);

		if (UseBoundingBoxForConnectionGraphFiltering)
		{
			constexpr auto IsOverlappingConnectionUsingCVarMargin =
				[](const FPBDRigidParticleHandle* Child1, const FPBDRigidParticleHandle* Child2)
			{
				return IsOverlappingConnection(Child1, Child2, BoundingBoxMarginForConnectionGraphFiltering);
			};