p.Chaos.Convex.MinVolume

p.Chaos.Convex.MinVolume

#Overview

name: p.Chaos.Convex.MinVolume

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.Chaos.Convex.MinVolume is to set the minimum volume threshold for simplified convex shapes in the Chaos physics engine of Unreal Engine 5.

This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics simulation module. Specifically, it’s utilized in the convex optimization process within the Chaos namespace.

The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 10000.0f and can be modified at runtime using the console command system.

The associated variable ChaosConvexMinVolume directly interacts with p.Chaos.Convex.MinVolume. They share the same value, with ChaosConvexMinVolume being the actual float variable used in the code, while p.Chaos.Convex.MinVolume is the console variable name used to expose this setting to users.

Developers must be aware that this variable affects the simplification process of convex shapes in the physics simulation. It sets a lower bound on the volume of simplified convexes, which can impact performance and simulation accuracy.

Best practices when using this variable include:

  1. Carefully adjusting the value based on the scale and requirements of your game world.
  2. Testing thoroughly after changes, as it can affect physics behavior and performance.
  3. Considering the trade-off between simulation accuracy and performance when modifying this value.

Regarding the associated variable ChaosConvexMinVolume:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:29

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	// Min volume of the simplified convexes
	float ChaosConvexMinVolume = 10000.0f;
	FAutoConsoleVariableRef CVarChaosConvexMinVolume(TEXT("p.Chaos.Convex.MinVolume"), ChaosConvexMinVolume, TEXT("Min volume of the simplified convexes"));

	// Boolean to check if we are merging (bottom-up) or splitting (top-bottom) the convexes 
	bool ChaosConvexEnableMerging = true;
	FAutoConsoleVariableRef CVarChaosConvexEnableMerging(TEXT("p.Chaos.Convex.EnableMerging"), ChaosConvexEnableMerging, TEXT("Boolean to check if we are merging (bottom-up) or splitting (top-bottom) the convexes"));
	
	extern int32 ChaosUnionBVHMaxDepth;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:28

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


	// Min volume of the simplified convexes
	float ChaosConvexMinVolume = 10000.0f;
	FAutoConsoleVariableRef CVarChaosConvexMinVolume(TEXT("p.Chaos.Convex.MinVolume"), ChaosConvexMinVolume, TEXT("Min volume of the simplified convexes"));

	// Boolean to check if we are merging (bottom-up) or splitting (top-bottom) the convexes 
	bool ChaosConvexEnableMerging = true;
	FAutoConsoleVariableRef CVarChaosConvexEnableMerging(TEXT("p.Chaos.Convex.EnableMerging"), ChaosConvexEnableMerging, TEXT("Boolean to check if we are merging (bottom-up) or splitting (top-bottom) the convexes"));
	
	extern int32 ChaosUnionBVHMaxDepth;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:486

Scope (from outer to inner):

file
namespace    Chaos
namespace    Private
function     void FConvexOptimizer::BuildMultipleConvex

Source code excerpt:

        for(int32 NodeIndex = 0, NumMerged = MergedNodes.Num(); NodeIndex < NumMerged; ++NodeIndex)
        {
            if(MergedNodes[NodeIndex].NodeTribox.HasDatas() && (MergedNodes[NodeIndex].NodeVolume > CVars::ChaosConvexMinVolume))
            {
            	auto* RootTribox = RootTriboxes.Find(UnionGeometry->GetObjects()[MergedNodes[NodeIndex].ShapeIndex]);
            	if(!RootTribox->TriboxConvex || (RootTribox->TriboxConvex && (RootTribox->TriboxConvex->AsA<FConvex>()->GetVolume() != MergedNodes[NodeIndex].NodeTribox.ComputeVolume())))
            	{
            		RootTribox->TriboxConvex = MergedNodes[NodeIndex].NodeTribox.MakeConvex();
					RootTribox->ConvexId = NextConvexId++;