r.PhysicsField.Rendering.EvalType

r.PhysicsField.Rendering.EvalType

#Overview

name: r.PhysicsField.Rendering.EvalType

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.PhysicsField.Rendering.EvalType is to control the evaluation method for physics field visualization in Unreal Engine 5. It determines whether the physics field is evaluated exactly (0) or sampled (1) for visualization purposes.

This setting variable is primarily used in the rendering system, specifically in the physics field rendering subsystem. It is part of the Renderer module in Unreal Engine 5.

The value of this variable is set through the console variable system. It is initialized with a default value of 0 and can be changed at runtime using console commands or through code.

The associated variable GPhysicsFieldEvalType interacts directly with r.PhysicsField.Rendering.EvalType. They share the same value, with GPhysicsFieldEvalType being the actual integer variable used in the code, while r.PhysicsField.Rendering.EvalType is the console variable name used for external access and modification.

Developers should be aware that changing this variable affects the visualization of physics fields in the engine. Setting it to 0 will result in exact evaluation, while setting it to 1 will use sampling for visualization. This can impact both the accuracy and performance of the physics field rendering.

Best practices when using this variable include:

  1. Consider the trade-off between accuracy (exact evaluation) and performance (sampling) when choosing the evaluation type.
  2. Use exact evaluation (0) when precise visualization is required, especially during debugging or analysis of physics fields.
  3. Use sampling (1) when performance is a priority and slight visual approximations are acceptable.
  4. Be consistent in its usage across different parts of the project to ensure uniform visualization behavior.

Regarding the associated variable GPhysicsFieldEvalType:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:28

Scope: file

Source code excerpt:

int32 GPhysicsFieldEvalType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldEvalType(
	TEXT("r.PhysicsField.Rendering.EvalType"),
	GPhysicsFieldEvalType,
	TEXT("Physics field boolean to check if we are evaluating exactly(0) or sampling(1) the field for visualisation.\n"),
	ECVF_RenderThreadSafe);

int32 GPhysicsFieldSystemType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSystemType(

#Associated Variable and Callsites

This variable is associated with another variable named GPhysicsFieldEvalType. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:26

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

int32 GPhysicsFieldEvalType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldEvalType(
	TEXT("r.PhysicsField.Rendering.EvalType"),
	GPhysicsFieldEvalType,
	TEXT("Physics field boolean to check if we are evaluating exactly(0) or sampling(1) the field for visualisation.\n"),
	ECVF_RenderThreadSafe);

int32 GPhysicsFieldSystemType = 0;
FAutoConsoleVariableRef CVarPhysicsFieldSystemType(
	TEXT("r.PhysicsField.Rendering.SystemType"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PhysicsFieldRendering.cpp:153

Scope (from outer to inner):

file
function     static void AddPhysicsFieldRayMarchingPass
lambda-function

Source code excerpt:

			FPhysicsFieldRayMarchingCS::FPermutationDomain PermutationVector;
			PermutationVector.Set<FPhysicsFieldRayMarchingCS::FFieldType>(bClearBackground ? 3 : FieldOutputType);
			PermutationVector.Set<FPhysicsFieldRayMarchingCS::FEvalType>(GPhysicsFieldEvalType);
			TShaderMapRef<FPhysicsFieldRayMarchingCS> ComputeShader(View.ShaderMap, PermutationVector);

			const FIntVector DispatchCount = (!bClearBackground && (FieldOutputType == EFieldOutputType::Field_Output_Vector)) ?
				FIntVector::DivideAndRoundUp(BoundResolution, FIntVector(4, 4, 4)) :
				FIntVector::DivideAndRoundUp(FIntVector(OutputResolution.X, OutputResolution.Y, 1), FIntVector(8, 8, 1));