r.PhysicsField.ClipmapCount

r.PhysicsField.ClipmapCount

#Overview

name: r.PhysicsField.ClipmapCount

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 r.PhysicsField.ClipmapCount is to set the number of clipmaps used for the physics field in Unreal Engine 5. This setting variable is primarily used in the physics system, specifically for managing physics fields.

The Unreal Engine subsystem that relies on this setting variable is the physics system, particularly the physics field component. This can be seen from the file path “Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp”.

The value of this variable is set through the console variable system. It is initialized with a default value of 4 and can be modified at runtime using the console command “r.PhysicsField.ClipmapCount”.

This variable interacts directly with its associated variable GPhysicsFieldClipmapCount. They share the same value, with GPhysicsFieldClipmapCount being the actual integer variable used in the code, while r.PhysicsField.ClipmapCount is the console variable that controls it.

Developers must be aware that changing this variable will affect the number of clipmaps used in physics field calculations. This could have performance implications and affect the accuracy or detail of physics simulations involving fields.

Best practices when using this variable include:

  1. Only modify it if you have a good understanding of the physics field system.
  2. Be mindful of performance impacts when increasing the number of clipmaps.
  3. Test thoroughly after making changes to ensure desired physics behavior is maintained.

Regarding the associated variable GPhysicsFieldClipmapCount:

The purpose of GPhysicsFieldClipmapCount is to store the actual integer value for the number of clipmaps used in physics field calculations. It is directly controlled by the r.PhysicsField.ClipmapCount console variable.

This variable is used within the FPhysicsFieldResource constructor to initialize the ClipmapCount member of the FieldInfos struct. It directly affects the size of various arrays and the number of calculations performed in physics field simulations.

The value of GPhysicsFieldClipmapCount is set at the file scope and can be modified through the associated console variable.

Developers should be aware that this variable is used in core physics field calculations and changing it will directly affect the behavior and performance of physics field simulations.

Best practices for GPhysicsFieldClipmapCount are similar to those for r.PhysicsField.ClipmapCount, as they are essentially two sides of the same coin. Any changes should be made with careful consideration of the impact on physics simulations and overall game performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:65

Scope: file

Source code excerpt:

int32 GPhysicsFieldClipmapCount = 4;
FAutoConsoleVariableRef CVarPhysicsFieldClipmapCount(
	TEXT("r.PhysicsField.ClipmapCount"),
	GPhysicsFieldClipmapCount,
	TEXT("Number of clipmaps used for the physics field"),
	ECVF_RenderThreadSafe
);

/** Exponent used to compute each clipmaps distance */

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:63

Scope: file

Source code excerpt:


/** Number of used clipmaps */
int32 GPhysicsFieldClipmapCount = 4;
FAutoConsoleVariableRef CVarPhysicsFieldClipmapCount(
	TEXT("r.PhysicsField.ClipmapCount"),
	GPhysicsFieldClipmapCount,
	TEXT("Number of clipmaps used for the physics field"),
	ECVF_RenderThreadSafe
);

/** Exponent used to compute each clipmaps distance */
float GPhysicsFieldClipmapExponent = 2;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:402

Scope (from outer to inner):

file
function     FPhysicsFieldResource::FPhysicsFieldResource

Source code excerpt:


	FieldInfos.ClipmapExponent = GPhysicsFieldClipmapExponent;
	FieldInfos.ClipmapCount = GPhysicsFieldClipmapCount;
	FieldInfos.ClipmapDistance = GPhysicsFieldClipmapDistance;
	FieldInfos.ClipmapResolution = GPhysicsFieldClipmapResolution;

	const uint32 CellsCount = FieldInfos.ClipmapCount * EFieldPhysicsType::Field_PhysicsType_Max;
	FieldInfos.CellsOffsets.Init(0, CellsCount + 1);
	FieldInfos.CellsMin.Init(FIntVector4(0), CellsCount);