r.PhysicsField.EnableCulling
r.PhysicsField.EnableCulling
#Overview
name: r.PhysicsField.EnableCulling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable the spatial culling based on the field nodes bounds
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PhysicsField.EnableCulling is to control the spatial culling functionality for physics field nodes based on their bounds. This setting is part of the physics simulation system in Unreal Engine 5.
This setting variable is primarily used in the Engine module, specifically within the physics field component implementation. It’s part of the physics simulation subsystem of Unreal Engine.
The value of this variable is set through an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. Its default value is 1, indicating that culling is enabled by default.
The associated variable GPhysicsFieldEnableCulling directly interacts with r.PhysicsField.EnableCulling. They share the same value, with GPhysicsFieldEnableCulling being the actual integer variable used in the code logic.
Developers should be aware that this variable affects performance and accuracy of physics simulations involving field nodes. When enabled (set to 1), it allows for spatial culling based on the field nodes’ bounds, which can improve performance by reducing unnecessary calculations for out-of-bounds nodes.
Best practices when using this variable include:
- Keep it enabled (set to 1) for better performance in most scenarios.
- Consider disabling it (set to 0) only if you notice issues with physics field behavior that might be caused by overzealous culling.
- Profile your game with both settings to determine the optimal configuration for your specific use case.
Regarding the associated variable GPhysicsFieldEnableCulling:
- It’s an integer variable that directly controls the culling behavior in the code.
- It’s used in the UpdateBounds function of FPhysicsFieldResource to determine whether to perform culling calculations.
- When set to 1, it enables the culling logic within the physics field component.
- Developers should treat this variable as read-only in their code and use the console variable r.PhysicsField.EnableCulling to modify 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:101
Scope: file
Source code excerpt:
int32 GPhysicsFieldEnableCulling = 1;
FAutoConsoleVariableRef CVarPhysicsFieldEnableCulling(
TEXT("r.PhysicsField.EnableCulling"),
GPhysicsFieldEnableCulling,
TEXT("Enable the spatial culling based on the field nodes bounds"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named GPhysicsFieldEnableCulling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:99
Scope: file
Source code excerpt:
/** Spatial culling */
int32 GPhysicsFieldEnableCulling = 1;
FAutoConsoleVariableRef CVarPhysicsFieldEnableCulling(
TEXT("r.PhysicsField.EnableCulling"),
GPhysicsFieldEnableCulling,
TEXT("Enable the spatial culling based on the field nodes bounds"),
ECVF_RenderThreadSafe
);
/**
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsField/PhysicsFieldComponent.cpp:466
Scope (from outer to inner):
file
function void FPhysicsFieldResource::UpdateBounds
Source code excerpt:
FieldInfos.CellsMax.Init(FIntVector4(FieldInfos.ClipmapResolution), CellsCount);
if(GPhysicsFieldEnableCulling == 1)
{
FieldInfos.ValidCount = 0;
for (auto& TargetType : FieldInfos.TargetTypes)
{
if((TargetOffsets[TargetType+1]- TargetOffsets[TargetType]) > 0)
{