r.PhysicsField.Rendering.SystemType
r.PhysicsField.Rendering.SystemType
#Overview
name: r.PhysicsField.Rendering.SystemType
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Physics field boolean to check if we want to display the CPU(0) or GPU(1) field.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PhysicsField.Rendering.SystemType is to control which physics field system type to display in the rendering process. It’s used in the physics field rendering system of Unreal Engine 5.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the physics field rendering subsystem. It’s referenced in the file PhysicsFieldRendering.cpp, which suggests it’s closely tied to the rendering of physics fields.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 0 and can be changed at runtime using console commands.
The variable interacts directly with GPhysicsFieldSystemType, which is the actual integer variable that stores the system type value. They share the same value, with r.PhysicsField.Rendering.SystemType being the console variable name used to modify GPhysicsFieldSystemType.
Developers must be aware that this variable determines whether the CPU (0) or GPU (1) field is displayed. This choice can have implications on performance and visual output, depending on the specific use case and hardware capabilities.
Best practices when using this variable include:
- Consider the target hardware when choosing between CPU and GPU field rendering.
- Use it in conjunction with performance profiling to determine the most efficient setting for your specific game or application.
- Be aware that changing this value at runtime may affect rendering performance and visual consistency.
Regarding the associated variable GPhysicsFieldSystemType:
The purpose of GPhysicsFieldSystemType is to store the actual integer value that determines whether the CPU (0) or GPU (1) physics field system is used for rendering.
This variable is used directly in the rendering code to determine which physics field resource to use (DebugResource for CPU, FieldResource for GPU). It’s primarily used in the Renderer module, specifically in the physics field rendering system.
The value of GPhysicsFieldSystemType is set through the r.PhysicsField.Rendering.SystemType console variable. It’s initialized to 0 by default, favoring CPU rendering initially.
GPhysicsFieldSystemType interacts directly with r.PhysicsField.Rendering.SystemType, as they share the same value. It’s also used in conditional statements to determine which physics field resource to use in the rendering process.
Developers should be aware that this variable directly affects the rendering pipeline’s behavior. Changing its value will switch between CPU and GPU-based physics field rendering, which can have significant performance and visual implications.
Best practices for using GPhysicsFieldSystemType include:
- Use it in conjunction with performance metrics to determine the most efficient rendering method for your specific use case.
- Consider the capabilities of your target hardware when choosing between CPU and GPU rendering.
- Be cautious when modifying this value during runtime, as it may cause sudden changes in rendering behavior or performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:35
Scope: file
Source code excerpt:
int32 GPhysicsFieldSystemType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSystemType(
TEXT("r.PhysicsField.Rendering.SystemType"),
GPhysicsFieldSystemType,
TEXT("Physics field boolean to check if we want to display the CPU(0) or GPU(1) field.\n"),
ECVF_RenderThreadSafe);
float GPhysicsFieldTransientLifetime = 3.0f;
FAutoConsoleVariableRef CVarPhysicsFieldTransientLifetime(
#Associated Variable and Callsites
This variable is associated with another variable named GPhysicsFieldSystemType
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:33
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
int32 GPhysicsFieldSystemType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSystemType(
TEXT("r.PhysicsField.Rendering.SystemType"),
GPhysicsFieldSystemType,
TEXT("Physics field boolean to check if we want to display the CPU(0) or GPU(1) field.\n"),
ECVF_RenderThreadSafe);
float GPhysicsFieldTransientLifetime = 3.0f;
FAutoConsoleVariableRef CVarPhysicsFieldTransientLifetime(
TEXT("r.PhysicsField.Rendering.TransientLifetime"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:193
Scope (from outer to inner):
file
function void RenderPhysicsField
Source code excerpt:
if (PhysicsFieldProxy)
{
FPhysicsFieldResource* PhysicsFieldResource = (GPhysicsFieldSystemType == 0) ? PhysicsFieldProxy->DebugResource : PhysicsFieldProxy->FieldResource;
if (Views.Num() > 0 && PhysicsFieldResource && ShaderPrint::IsEnabled(Views[0].ShaderPrintData) && UE::PixelFormat::HasCapabilities(PF_FloatRGBA, EPixelFormatCapabilities::TypedUAVLoad))
{
if (ShaderPrint::IsSupported(Views[0].GetShaderPlatform()) && IsFeatureLevelSupported(Views[0].GetShaderPlatform(), ERHIFeatureLevel::SM5))
{
AddPhysicsFieldRayMarchingPass(GraphBuilder, Views[0], PhysicsFieldResource, SceneColorTexture);
}