r.ParallelTranslucency
r.ParallelTranslucency
#Overview
name: r.ParallelTranslucency
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Toggles parallel translucency rendering. Parallel rendering must be enabled for this to have an effect.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ParallelTranslucency is to toggle parallel translucency rendering in Unreal Engine 5. This setting is primarily used for the rendering system, specifically for optimizing the rendering of translucent objects.
This setting variable is relied upon by the Renderer module of Unreal Engine, particularly in the translucent rendering subsystem. It is used in the TranslucentRendering.cpp file, which is part of the core rendering pipeline.
The value of this variable is set through a console variable (CVarParallelTranslucency) with a default value of 1 (enabled). It can be changed at runtime using console commands or through project settings.
The associated variable CVarParallelTranslucency directly interacts with r.ParallelTranslucency. They share the same value and purpose.
Developers must be aware that this variable only has an effect when parallel rendering is enabled in the engine. It’s important to note that enabling parallel translucency can impact performance and may require additional testing and optimization.
Best practices when using this variable include:
- Ensuring that parallel rendering is enabled for the setting to take effect.
- Testing the performance impact in various scenarios, as parallel rendering can sometimes introduce overhead.
- Considering the interaction with other rendering settings, especially those related to translucency and parallel processing.
Regarding the associated variable CVarParallelTranslucency:
The purpose of CVarParallelTranslucency is to provide a programmatic way to access and modify the r.ParallelTranslucency setting within the C++ code.
This variable is used within the Renderer module, specifically in the IsParallelTranslucencyEnabled() function, which checks if parallel translucency should be applied.
The value of CVarParallelTranslucency is set when the r.ParallelTranslucency console variable is initialized or modified.
CVarParallelTranslucency interacts directly with the GRHICommandList.UseParallelAlgorithms() function to determine if parallel translucency should be enabled.
Developers should be aware that this variable is accessed on the render thread, which is important for thread safety considerations.
Best practices for using CVarParallelTranslucency include:
- Accessing its value using the GetValueOnRenderThread() method to ensure thread safety.
- Considering the performance implications of enabling or disabling parallel translucency in different parts of the rendering pipeline.
- Using this variable in conjunction with other rendering optimizations to achieve the best balance of visual quality and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:106
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarParallelTranslucency(
TEXT("r.ParallelTranslucency"),
1,
TEXT("Toggles parallel translucency rendering. Parallel rendering must be enabled for this to have an effect."),
ECVF_RenderThreadSafe);
DynamicRenderScaling::FHeuristicSettings GetDynamicTranslucencyResolutionSettings()
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarParallelTranslucency
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:105
Scope: file
Source code excerpt:
TEXT("Wait for completion of parallel render thread tasks at the end of the translucent pass. A more granular version of r.RHICmdFlushRenderThreadTasks. If either r.RHICmdFlushRenderThreadTasks or r.RHICmdFlushRenderThreadTasksTranslucentPass is > 0 we will flush."));
static TAutoConsoleVariable<int32> CVarParallelTranslucency(
TEXT("r.ParallelTranslucency"),
1,
TEXT("Toggles parallel translucency rendering. Parallel rendering must be enabled for this to have an effect."),
ECVF_RenderThreadSafe);
DynamicRenderScaling::FHeuristicSettings GetDynamicTranslucencyResolutionSettings()
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:211
Scope (from outer to inner):
file
function static bool IsParallelTranslucencyEnabled
Source code excerpt:
static bool IsParallelTranslucencyEnabled()
{
return GRHICommandList.UseParallelAlgorithms() && CVarParallelTranslucency.GetValueOnRenderThread();
}
static bool IsTranslucencyWaitForTasksEnabled()
{
return IsParallelTranslucencyEnabled() && (CVarRHICmdFlushRenderThreadTasksTranslucentPass.GetValueOnRenderThread() > 0 || CVarRHICmdFlushRenderThreadTasks.GetValueOnRenderThread() > 0);
}