r.PhysicsField.ClipmapResolution
r.PhysicsField.ClipmapResolution
#Overview
name: r.PhysicsField.ClipmapResolution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Resolution of the physics field. Higher values increase fidelity but also increase memory and composition cost.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PhysicsField.ClipmapResolution is to control the resolution of the physics field in Unreal Engine 5. This setting variable is used in the physics system, specifically for physics fields.
This setting variable is primarily used in the Engine module, particularly in the PhysicsField subsystem. It’s referenced in the PhysicsFieldComponent.cpp file, which suggests it’s an integral part of the physics field functionality.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. The default value is 32.
The associated variable GPhysicsFieldClipmapResolution directly interacts with r.PhysicsField.ClipmapResolution. They share the same value, with GPhysicsFieldClipmapResolution being the actual integer variable used in the code.
Developers must be aware that changing this variable affects both the fidelity and performance of the physics field. Higher values increase fidelity but also increase memory usage and composition cost. This trade-off should be carefully considered when adjusting the value.
Best practices when using this variable include:
- Balance between fidelity and performance based on the specific needs of your project.
- Test thoroughly after making changes to ensure optimal performance.
- Consider the target hardware when setting this value, as higher resolutions may impact performance on less powerful devices.
Regarding the associated variable GPhysicsFieldClipmapResolution:
The purpose of GPhysicsFieldClipmapResolution is to store the actual integer value of the physics field clipmap resolution. It’s used directly in the code to set up the physics field resources.
This variable is used in the Engine module, specifically in the PhysicsFieldComponent. It’s crucial for initializing the FPhysicsFieldResource, which is likely a core component of the physics field system.
The value of GPhysicsFieldClipmapResolution is set by the r.PhysicsField.ClipmapResolution console variable.
GPhysicsFieldClipmapResolution interacts directly with other physics field parameters such as ClipmapCount and ClipmapDistance when initializing the FPhysicsFieldResource.
Developers should be aware that this variable directly affects the size and resolution of the physics field clipmaps. Changes to this value will impact the memory usage and performance of the physics field system.
Best practices for using GPhysicsFieldClipmapResolution include:
- Avoid modifying it directly in code; instead, use the r.PhysicsField.ClipmapResolution console variable.
- Consider the impact on performance and memory usage when adjusting this value.
- Ensure that any code relying on this variable can handle potential runtime changes to its value.
#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:83
Scope: file
Source code excerpt:
int32 GPhysicsFieldClipmapResolution = 32;
FAutoConsoleVariableRef CVarPhysicsFieldClipmapResolution(
TEXT("r.PhysicsField.ClipmapResolution"),
GPhysicsFieldClipmapResolution,
TEXT("Resolution of the physics field. Higher values increase fidelity but also increase memory and composition cost."),
ECVF_RenderThreadSafe
);
/** Single Target Limit */
#Associated Variable and Callsites
This variable is associated with another variable named GPhysicsFieldClipmapResolution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:81
Scope: file
Source code excerpt:
/** Resolution of each clipmaps */
int32 GPhysicsFieldClipmapResolution = 32;
FAutoConsoleVariableRef CVarPhysicsFieldClipmapResolution(
TEXT("r.PhysicsField.ClipmapResolution"),
GPhysicsFieldClipmapResolution,
TEXT("Resolution of the physics field. Higher values increase fidelity but also increase memory and composition cost."),
ECVF_RenderThreadSafe
);
/** Single Target Limit */
int32 GPhysicsFieldSingleTarget = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:404
Scope (from outer to inner):
file
function FPhysicsFieldResource::FPhysicsFieldResource
Source code excerpt:
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);
FieldInfos.CellsMax.Init(FIntVector4(FieldInfos.ClipmapResolution), CellsCount);