r.Translucency.Velocity
r.Translucency.Velocity
#Overview
name: r.Translucency.Velocity
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether translucency can draws depth/velocity (enabled by default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Translucency.Velocity is to control whether translucent objects in the scene can draw depth and velocity information. This setting is primarily used in the rendering system of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the deferred shading renderer. This can be seen from the file location where the variable is defined and used: ‘Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp’.
The value of this variable is set as a console variable with a default value of 1 (enabled). It can be changed at runtime through the console or programmatically.
The associated variable CVarTranslucencyVelocity interacts directly with r.Translucency.Velocity. They share the same value and purpose.
Developers must be aware that this variable affects the rendering of translucent objects, specifically their depth and velocity information. When enabled (value = 1), translucent objects will draw depth and velocity information, which can be important for certain post-processing effects like motion blur or temporal anti-aliasing.
Best practices when using this variable include:
- Keep it enabled (default value of 1) unless there’s a specific reason to disable it.
- Be aware that disabling this might affect the quality of motion-based effects for translucent objects.
- If performance is a concern, consider disabling this for less important translucent objects or in performance-critical scenarios.
Regarding the associated variable CVarTranslucencyVelocity:
- Its purpose is identical to r.Translucency.Velocity.
- It’s used in the same Renderer module.
- Its value is set in the same way as r.Translucency.Velocity.
- It’s used directly in the rendering code to determine whether to render velocities for translucent objects.
- Developers should treat it the same as r.Translucency.Velocity in terms of usage and best practices.
When working with either of these variables, developers should consider the performance implications of enabling depth and velocity rendering for translucent objects, especially in scenes with many translucent elements.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:220
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTranslucencyVelocity(
TEXT("r.Translucency.Velocity"), 1,
TEXT("Whether translucency can draws depth/velocity (enabled by default)"),
ECVF_RenderThreadSafe);
static FAutoConsoleCommand RecreateRenderStateContextCmd(
TEXT("r.RecreateRenderStateContext"),
TEXT("Recreate render state."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarTranslucencyVelocity
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:219
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarTranslucencyVelocity(
TEXT("r.Translucency.Velocity"), 1,
TEXT("Whether translucency can draws depth/velocity (enabled by default)"),
ECVF_RenderThreadSafe);
static FAutoConsoleCommand RecreateRenderStateContextCmd(
TEXT("r.RecreateRenderStateContext"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:3111
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::Render
Source code excerpt:
}
if (bShouldRenderVelocities && CVarTranslucencyVelocity.GetValueOnRenderThread() != 0)
{
const bool bRecreateSceneTextures = !HasBeenProduced(SceneTextures.Velocity);
GraphBuilder.SetCommandListStat(GET_STATID(STAT_CLM_TranslucentVelocity));
RenderVelocities(GraphBuilder, Views, SceneTextures, EVelocityPass::Translucent, false);