FX.GPUCollisionDepthBounds
FX.GPUCollisionDepthBounds
#Overview
name: FX.GPUCollisionDepthBounds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Limits the depth bounds when searching for a collision plane.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FX.GPUCollisionDepthBounds is to limit the depth bounds when searching for a collision plane in GPU-based particle simulations. This setting variable is primarily used in the particle effects (FX) system of Unreal Engine 5, specifically for GPU-accelerated particle simulations.
The Unreal Engine subsystem that relies on this setting variable is the particle system, particularly the GPU-based particle simulation module. This can be seen from the file locations where the variable is referenced, such as ‘FXSystem.cpp’ and ‘ParticleGpuSimulation.cpp’.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.
The associated variable that interacts with FX.GPUCollisionDepthBounds is GPUCollisionDepthBounds. They share the same value, with GPUCollisionDepthBounds being the actual float variable used in the code, while FX.GPUCollisionDepthBounds is the console variable name used for external access and modification.
Developers must be aware that this variable affects the performance and accuracy of GPU-based particle collision detection. A larger value will increase the search space for collisions, potentially improving accuracy but at the cost of performance. Conversely, a smaller value may improve performance but could miss some collisions if set too low.
Best practices when using this variable include:
- Adjusting it based on the scale and requirements of your specific particle effects.
- Balancing between performance and collision accuracy.
- Testing thoroughly with different values to find the optimal setting for your game’s needs.
- Considering the potential impact on different hardware configurations, especially when targeting a wide range of devices.
Regarding the associated variable GPUCollisionDepthBounds:
The purpose of GPUCollisionDepthBounds is to store the actual float value used in the GPU particle simulation code. It represents the depth bounds for GPU collision checks.
This variable is used directly in the GPU particle simulation code, specifically in the ExecuteSimulationCommands function in ParticleGpuSimulation.cpp. It’s assigned to the CollisionDepthBounds parameter of the particle simulation shader.
The value of GPUCollisionDepthBounds is set through the FX.GPUCollisionDepthBounds console variable, allowing for runtime adjustment.
Developers should be aware that modifying GPUCollisionDepthBounds will directly affect the behavior of GPU particle collisions. It’s crucial to understand the implications of changing this value on both visual quality and performance.
Best practices for GPUCollisionDepthBounds include:
- Adjusting it in conjunction with FX.GPUCollisionDepthBounds for consistency.
- Monitoring its impact on GPU performance, especially in scenes with many particle effects.
- Considering its interaction with other particle system parameters for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:198
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
);
FAutoConsoleVariableRef CVarGPUCollisionDepthBounds(
TEXT("FX.GPUCollisionDepthBounds"),
GPUCollisionDepthBounds,
TEXT("Limits the depth bounds when searching for a collision plane."),
ECVF_Cheat
);
FAutoConsoleVariableRef CVarAllowCulling(
TEXT("FX.AllowCulling"),
#Associated Variable and Callsites
This variable is associated with another variable named GPUCollisionDepthBounds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:132
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
int32 MaxGPUParticlesSpawnedPerFrame = 1024 * 1024;
int32 GPUSpawnWarningThreshold = 20000;
float GPUCollisionDepthBounds = 500.0f;
TAutoConsoleVariable<int32> TestGPUSort(TEXT("FX.TestGPUSort"),0,TEXT("Test GPU sort. 1: Small, 2: Large, 3: Exhaustive, 4: Random"),ECVF_Cheat);
/** Register references to flags. */
FAutoConsoleVariableRef CVarVisualizeGPUSimulation(
TEXT("FX.VisualizeGPUSimulation"),
VisualizeGPUSimulation,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:199
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
FAutoConsoleVariableRef CVarGPUCollisionDepthBounds(
TEXT("FX.GPUCollisionDepthBounds"),
GPUCollisionDepthBounds,
TEXT("Limits the depth bounds when searching for a collision plane."),
ECVF_Cheat
);
FAutoConsoleVariableRef CVarAllowCulling(
TEXT("FX.AllowCulling"),
bAllowCulling,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleGpuSimulation.cpp:1540
Scope (from outer to inner):
file
function void ExecuteSimulationCommands
Source code excerpt:
if (CollisionMode == PCM_DepthBuffer)
{
PsParameters.CollisionDepthBounds = FXConsoleVariables::GPUCollisionDepthBounds;
}
else if (CollisionMode == PCM_DistanceField)
{
PsParameters.GlobalDistanceFieldParameters = SetupGlobalDistanceFieldParameters_Minimal(*GlobalDistanceFieldParameterData);
// TODO Move to common place without adding extra dependencies
PsParameters.GlobalDistanceFieldParameters.GlobalDistanceFieldCoverageAtlasTextureSampler = TStaticSamplerState<SF_Trilinear, AM_Wrap, AM_Wrap, AM_Wrap>::GetRHI();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/FXSystem.h:83
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
extern int32 GPUSpawnWarningThreshold;
/** Depth bounds for GPU collision checks. */
extern float GPUCollisionDepthBounds;
/** Specify a sorting test to run. */
extern TAutoConsoleVariable<int32> TestGPUSort;
/** true if GPU particles are allowed. */
extern int32 bAllowGPUParticles;
}