p.BoundingBoxMarginForConnectionGraphFiltering

p.BoundingBoxMarginForConnectionGraphFiltering

#Overview

name: p.BoundingBoxMarginForConnectionGraphFiltering

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.BoundingBoxMarginForConnectionGraphFiltering is to provide a margin value for bounding box overlap tests during connection graph generation in the Chaos physics system of Unreal Engine 5.

This setting variable is primarily used in the Chaos physics subsystem, specifically in the rigid clustering module. It is part of the experimental Chaos namespace, indicating that it’s used in the new physics engine being developed for Unreal Engine.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized to 0 by default, but can be changed at runtime using console commands or through configuration files.

This variable interacts closely with another console variable, p.UseBoundingBoxForConnectionGraphFiltering. When UseBoundingBoxForConnectionGraphFiltering is enabled, BoundingBoxMarginForConnectionGraphFiltering is used to add a margin to the bounding box overlap test during connection graph generation.

Developers should be aware that this variable only takes effect when UseBoundingBoxForConnectionGraphFiltering is enabled. The margin value can significantly affect the performance and behavior of the connection graph generation process.

Best practices when using this variable include:

  1. Only modify it if you understand the implications on the physics simulation.
  2. Use small values to start with and gradually increase if needed.
  3. Monitor performance impacts when adjusting this value, especially in scenes with many rigid bodies.

Regarding the associated variable BoundingBoxMarginForConnectionGraphFiltering:

The purpose of BoundingBoxMarginForConnectionGraphFiltering is to store the actual value used in the physics calculations. It’s the C++ variable that holds the value set by the console variable p.BoundingBoxMarginForConnectionGraphFiltering.

This variable is used directly in the physics code, specifically in the UpdateConnectivityGraphUsingDelaunayTriangulation function of the FRigidClustering class. It’s passed as an argument to the IsOverlappingConnection function, which likely uses this margin to determine if two particles should be connected in the graph.

The value of this variable is set by the console variable system when p.BoundingBoxMarginForConnectionGraphFiltering is modified.

Developers should be aware that changes to p.BoundingBoxMarginForConnectionGraphFiltering will directly affect this variable, and thus the behavior of the connection graph generation.

Best practices for this variable are the same as for p.BoundingBoxMarginForConnectionGraphFiltering, as they are directly linked. Any changes should be made carefully and with consideration for the overall impact on the physics simulation.

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:


	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]"));

	float GraphPropagationBasedCollisionFactor = 1;
	FAutoConsoleVariableRef CVarGraphPropagationBasedCollisionFactor(TEXT("p.GraphPropagationBasedCollisionFactor"), GraphPropagationBasedCollisionFactor, TEXT("when p.GraphPropagationBasedCollisionImpulseProcessing is on, the percentage [0-1] of remaining damage that is distributed to the connected pieces"));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	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]"));

	float GraphPropagationBasedCollisionFactor = 1;
	FAutoConsoleVariableRef CVarGraphPropagationBasedCollisionFactor(TEXT("p.GraphPropagationBasedCollisionFactor"), GraphPropagationBasedCollisionFactor, TEXT("when p.GraphPropagationBasedCollisionImpulseProcessing is on, the percentage [0-1] of remaining damage that is distributed to the connected pieces"));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FRigidClustering::UpdateConnectivityGraphUsingDelaunayTriangulation
lambda-function

Source code excerpt:

				[](const FPBDRigidParticleHandle* Child1, const FPBDRigidParticleHandle* Child2)
			{
				return IsOverlappingConnection(Child1, Child2, BoundingBoxMarginForConnectionGraphFiltering);
			};
			UpdateConnectivityGraphUsingDelaunayTriangulationWithFiltering(Particles, IsOverlappingConnectionUsingCVarMargin, FromParticles, ToParticles);
		}
		else
		{
			UpdateConnectivityGraphUsingDelaunayTriangulationWithFiltering(Particles, IsAlwaysValidConnection, FromParticles, ToParticles);