r.Test.Aplha.OpaqueLerpWorldRange
r.Test.Aplha.OpaqueLerpWorldRange
#Overview
name: r.Test.Aplha.OpaqueLerpWorldRange
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets the gradient length in world unit on which opaque pixel are lerped to translucent for testing purposes.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Test.Aplha.OpaqueLerpWorldRange is to set the gradient length in world units for testing the transition between opaque and translucent pixels in the rendering system. This variable is specifically used for debugging and testing purposes in the alpha channel rendering process.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically in the post-processing subsystem. It’s referenced in the DebugAlphaChannel.cpp file, which suggests it’s part of a debugging tool for alpha channel rendering.
The value of this variable is set through a console variable (CVarTestAlphaOpaqueLerpWorldRange) with a default value of 100.0f. It can be modified at runtime through the console or programmatically.
This variable interacts with another variable called CVarTestAlphaOpaqueWorldDistance, which is likely used in conjunction to define the range and distance for the opaque-to-translucent transition effect.
Developers should be aware that this is a debugging and testing variable, not intended for use in final production builds. It’s specifically designed to visualize and test the transition between opaque and translucent pixels in the rendering pipeline.
Best practices when using this variable include:
- Only use it during development and testing phases.
- Experiment with different values to understand how it affects the rendering of alpha channels.
- Use it in conjunction with other debug rendering tools to get a comprehensive view of alpha channel behavior.
- Remember to disable or remove any usage of this variable before shipping the final product.
Regarding the associated variable CVarTestAlphaOpaqueLerpWorldRange:
The purpose of CVarTestAlphaOpaqueLerpWorldRange is to provide a programmatic interface to the r.Test.Aplha.OpaqueLerpWorldRange setting. It allows the engine to access and modify the value of this debug setting at runtime.
This variable is used in the same Renderer module and DebugAlphaChannel.cpp file. It’s defined as a TAutoConsoleVariable, which means it can be accessed and modified through the Unreal Engine console system.
The value of this variable is set initially to 100.0f, but can be changed at runtime through console commands or programmatically.
CVarTestAlphaOpaqueLerpWorldRange directly corresponds to the r.Test.Aplha.OpaqueLerpWorldRange setting, so any interaction with one affects the other.
Developers should be aware that this is the actual variable used in the code to access the setting value. When you need to read this setting in C++ code, you would use CVarTestAlphaOpaqueLerpWorldRange.GetValueOnRenderThread().
Best practices for using this variable include:
- Access it using GetValueOnRenderThread() when in render thread code.
- Be cautious about modifying its value during runtime, as it may affect ongoing rendering processes.
- Use it for debugging and testing purposes only, not in shipping code.
- Consider creating a development-only rendering path that uses this variable to avoid any performance impact in release builds.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DebugAlphaChannel.cpp:16
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarTestAlphaOpaqueLerpWorldRange(
TEXT("r.Test.Aplha.OpaqueLerpWorldRange"), 100.0f,
TEXT("Sets the gradient length in world unit on which opaque pixel are lerped to translucent for testing purposes."),
ECVF_RenderThreadSafe);
#endif // DEBUG_ALPHA_CHANNEL
class FDebugAlphaChannelCS : public FGlobalShader
#Associated Variable and Callsites
This variable is associated with another variable named CVarTestAlphaOpaqueLerpWorldRange
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DebugAlphaChannel.cpp:15
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarTestAlphaOpaqueLerpWorldRange(
TEXT("r.Test.Aplha.OpaqueLerpWorldRange"), 100.0f,
TEXT("Sets the gradient length in world unit on which opaque pixel are lerped to translucent for testing purposes."),
ECVF_RenderThreadSafe);
#endif // DEBUG_ALPHA_CHANNEL
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DebugAlphaChannel.cpp:69
Scope (from outer to inner):
file
function FRDGTextureMSAA MakeDistanceGeometryTranslucent
Source code excerpt:
PassParameters->DebugModeId = 0; // MakeDistanceOpaqueTranslucent
PassParameters->OpaqueWorldDistance = CVarTestAlphaOpaqueWorldDistance.GetValueOnRenderThread();
PassParameters->OpaqueLerpWorldRange = CVarTestAlphaOpaqueLerpWorldRange.GetValueOnRenderThread();
PassParameters->SceneColorTexture = SceneTextures.Color.Resolve;
PassParameters->SceneDepthTexture = SceneTextures.Depth.Resolve;
PassParameters->SceneColorOutput = GraphBuilder.CreateUAV(NewSceneColorTexture);