r.HeterogeneousVolumes.Composition
r.HeterogeneousVolumes.Composition
#Overview
name: r.HeterogeneousVolumes.Composition
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Change the order of Heterogeneous Volumes composition (Default = 0)\n0: Before Translucency\n1: After Translucency\nRequires enabling Heterogeneous Volumes Project Setting: \'Composite with Translucency\'
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Composition is to control the order of Heterogeneous Volumes composition in the rendering pipeline. This setting variable is part of Unreal Engine 5’s rendering system, specifically related to the Heterogeneous Volumes feature.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the HeterogeneousVolumes.cpp file within the Renderer’s private directory.
The value of this variable is set through a console variable (CVarHeterogeneousVolumesComposition) with an initial default value of 0. It can be changed at runtime through console commands or programmatically.
The associated variable CVarHeterogeneousVolumesComposition directly interacts with r.HeterogeneousVolumes.Composition. They share the same value and purpose.
Developers must be aware of the following when using this variable:
- It affects the order of Heterogeneous Volumes composition in relation to translucency.
- It requires the “Composite with Translucency” Project Setting to be enabled for Heterogeneous Volumes.
- The variable accepts two values: 0 (Before Translucency) and 1 (After Translucency).
Best practices when using this variable include:
- Consider the visual impact of compositing Heterogeneous Volumes before or after translucency in your specific use case.
- Ensure that the “Composite with Translucency” Project Setting is enabled when utilizing this variable.
- Use the appropriate composition order based on your scene’s requirements and performance considerations.
Regarding the associated variable CVarHeterogeneousVolumesComposition:
- Its purpose is identical to r.HeterogeneousVolumes.Composition, serving as the actual console variable implementation.
- It is used in the GetHeterogeneousVolumesCompositionType() function to determine the composition type at runtime.
- The value is accessed on the render thread using GetValueOnRenderThread(), ensuring thread-safe access.
- Developers should be aware that changes to this variable will affect the rendering pipeline in real-time.
- Best practices include using the appropriate Unreal Engine functions or console commands to modify this variable rather than directly manipulating it in code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:33
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesComposition(
TEXT("r.HeterogeneousVolumes.Composition"),
0,
TEXT("Change the order of Heterogeneous Volumes composition (Default = 0)\n")
TEXT("0: Before Translucency\n")
TEXT("1: After Translucency\n")
TEXT("Requires enabling Heterogeneous Volumes Project Setting: 'Composite with Translucency'"),
ECVF_RenderThreadSafe
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesComposition
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:32
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesComposition(
TEXT("r.HeterogeneousVolumes.Composition"),
0,
TEXT("Change the order of Heterogeneous Volumes composition (Default = 0)\n")
TEXT("0: Before Translucency\n")
TEXT("1: After Translucency\n")
TEXT("Requires enabling Heterogeneous Volumes Project Setting: 'Composite with Translucency'"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:282
Scope (from outer to inner):
file
function EHeterogeneousVolumesCompositionType GetHeterogeneousVolumesCompositionType
Source code excerpt:
EHeterogeneousVolumesCompositionType GetHeterogeneousVolumesCompositionType()
{
int32 CompositionOrder = CVarHeterogeneousVolumesComposition.GetValueOnRenderThread();
switch (CompositionOrder)
{
case 0:
default:
return EHeterogeneousVolumesCompositionType::BeforeTranslucent;
case 1: