r.Test.OverrideTimeMaterialExpressions
r.Test.OverrideTimeMaterialExpressions
#Overview
name: r.Test.OverrideTimeMaterialExpressions
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Value to freeze time material expressions with.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Test.OverrideTimeMaterialExpressions is to freeze time material expressions for testing and debugging purposes in Unreal Engine’s rendering system.
This setting variable is primarily used in the rendering subsystem of Unreal Engine, specifically in the scene view component. It’s referenced in the Engine module, within the SceneView.cpp file.
The value of this variable is set through a console variable (CVarOverrideTimeMaterialExpressions) using the TAutoConsoleVariable template. It’s initialized with a default value of -1.0f, which means the override is not active by default.
The associated variable CVarOverrideTimeMaterialExpressions interacts directly with r.Test.OverrideTimeMaterialExpressions. They share the same value and purpose.
Developers must be aware that:
- This variable is only active in non-shipping and non-test builds (wrapped in #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)).
- When set to a value >= 0.0f, it overrides the time values used in material expressions.
- It affects both game time and real time in the view uniform shader parameters.
Best practices when using this variable include:
- Use it only for debugging and testing purposes, not in production builds.
- Reset the value to -1.0f when done testing to ensure normal time progression in materials.
- Be cautious when using it in multiplayer scenarios, as it may cause visual inconsistencies between clients.
Regarding the associated variable CVarOverrideTimeMaterialExpressions:
- It’s a console variable that directly controls the behavior of r.Test.OverrideTimeMaterialExpressions.
- It’s defined as render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread.
- Its value is retrieved using GetValueOnRenderThread() method, ensuring thread-safe access in the render pipeline.
- When using this variable, developers should access its value through the console variable system rather than directly manipulating r.Test.OverrideTimeMaterialExpressions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:382
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarOverrideTimeMaterialExpressions(
TEXT("r.Test.OverrideTimeMaterialExpressions"), -1.0f,
TEXT("Value to freeze time material expressions with."),
ECVF_RenderThreadSafe);
#endif
/** Global vertex color view mode setting when SHOW_VertexColors show flag is set */
#Associated Variable and Callsites
This variable is associated with another variable named CVarOverrideTimeMaterialExpressions
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:381
Scope: file
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
static TAutoConsoleVariable<float> CVarOverrideTimeMaterialExpressions(
TEXT("r.Test.OverrideTimeMaterialExpressions"), -1.0f,
TEXT("Value to freeze time material expressions with."),
ECVF_RenderThreadSafe);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2721
Scope (from outer to inner):
file
function void FSceneView::SetupCommonViewUniformBufferParameters
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
float OverrideTimeMaterialExpression = CVarOverrideTimeMaterialExpressions.GetValueOnRenderThread();
if (OverrideTimeMaterialExpression >= 0.0f)
{
ViewUniformShaderParameters.PrevFrameGameTime = OverrideTimeMaterialExpression;
ViewUniformShaderParameters.PrevFrameRealTime = OverrideTimeMaterialExpression;
ViewUniformShaderParameters.GameTime = OverrideTimeMaterialExpression;
ViewUniformShaderParameters.RealTime = OverrideTimeMaterialExpression;