r.PhysicsField.BuildClipmap
r.PhysicsField.BuildClipmap
#Overview
name: r.PhysicsField.BuildClipmap
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Build the Physics field clipmap
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PhysicsField.BuildClipmap is to control the building of the Physics field clipmap in Unreal Engine 5. This setting variable is related to the physics simulation system, specifically the physics field component.
The Unreal Engine subsystem that relies on this setting variable is the Physics Field system, which is part of the Engine module. 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’s initialized with a default value of 1 and can be changed at runtime using the console command “r.PhysicsField.BuildClipmap”.
This variable interacts with the associated variable GPhysicsFieldBuildClipmap. They share the same value, with GPhysicsFieldBuildClipmap being the actual integer variable used in the code, while r.PhysicsField.BuildClipmap is the console variable name used to modify it.
Developers must be aware that this variable affects the performance and behavior of the physics field system. When set to 1, it enables the building of the physics field clipmap, which may have performance implications.
Best practices when using this variable include:
- Only enable it when necessary, as building the clipmap may have performance costs.
- Consider exposing it as a scalability setting, allowing it to be adjusted based on the target hardware capabilities.
- Test the performance impact of enabling/disabling this feature in various scenarios.
Regarding the associated variable GPhysicsFieldBuildClipmap:
The purpose of GPhysicsFieldBuildClipmap is to store the actual integer value determining whether to build the physics field clipmap or not.
This variable is used directly in the UPhysicsFieldComponent::OnRegister function to determine whether to build clipmaps for the field instances.
The value of this variable is set by the console variable system through r.PhysicsField.BuildClipmap.
GPhysicsFieldBuildClipmap interacts directly with the physics field component code, influencing the initialization of field instances.
Developers should be aware that this variable is used as a boolean check (== 1) in the code, so values other than 0 and 1 may lead to unexpected behavior.
Best practices for GPhysicsFieldBuildClipmap include:
- Treat it as a boolean value, using only 0 and 1 as valid inputs.
- Be cautious when modifying this variable directly in code, as it’s intended to be controlled via the console variable system.
- Consider the performance implications when enabling this feature, especially in performance-critical scenarios.
#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:41
Scope: file
Source code excerpt:
int32 GPhysicsFieldBuildClipmap = 1;
FAutoConsoleVariableRef CVarPhysicsFieldBuildClipmap(
TEXT("r.PhysicsField.BuildClipmap"),
GPhysicsFieldBuildClipmap,
TEXT("Build the Physics field clipmap"),
ECVF_Scalability | ECVF_RenderThreadSafe);
/** Clipmap enable/disable */
static TAutoConsoleVariable<int32> CVarPhysicsFieldEnableClipmap(
#Associated Variable and Callsites
This variable is associated with another variable named GPhysicsFieldBuildClipmap
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:39
Scope: file
Source code excerpt:
/** Boolean to check if we need to build or not the clipmap */
int32 GPhysicsFieldBuildClipmap = 1;
FAutoConsoleVariableRef CVarPhysicsFieldBuildClipmap(
TEXT("r.PhysicsField.BuildClipmap"),
GPhysicsFieldBuildClipmap,
TEXT("Build the Physics field clipmap"),
ECVF_Scalability | ECVF_RenderThreadSafe);
/** Clipmap enable/disable */
static TAutoConsoleVariable<int32> CVarPhysicsFieldEnableClipmap(
TEXT("r.PhysicsField.EnableField"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:904
Scope (from outer to inner):
file
function void UPhysicsFieldComponent::OnRegister
Source code excerpt:
Super::OnRegister();
TArray<bool> bBuildClipmaps = { GPhysicsFieldBuildClipmap == 1, false };
for (uint32 FieldIndex = 0; FieldIndex < 2; ++FieldIndex)
{
FPhysicsFieldInstance*& LocalInstance = (FieldIndex == 0) ? FieldInstance : DebugInstance;
if (!LocalInstance)
{
LocalInstance = new FPhysicsFieldInstance();