r.Lumen.TranslucencyReflections.RadianceCache
r.Lumen.TranslucencyReflections.RadianceCache
#Overview
name: r.Lumen.TranslucencyReflections.RadianceCache
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use the Radiance Cache to provide Lumen Reflections on Translucent Surfaces.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TranslucencyReflections.RadianceCache is to control whether the Radiance Cache is used to provide Lumen Reflections on Translucent Surfaces in Unreal Engine 5’s rendering system.
This setting variable is primarily used by the Lumen subsystem, which is part of Unreal Engine 5’s rendering module. Specifically, it’s used in the Lumen Translucency Radiance Cache feature.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
The associated variable GLumenTranslucencyRadianceCacheReflections directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the rendering of translucent surfaces with Lumen reflections. When enabled (set to non-zero), it allows the use of the Radiance Cache for these reflections, which can potentially improve performance and visual quality.
Best practices when using this variable include:
- Consider the performance implications of enabling or disabling this feature, especially on different hardware configurations.
- Test the visual quality of translucent reflections with this feature both enabled and disabled to ensure the desired look is achieved.
- Be aware that this setting interacts with other Lumen and rendering settings, so it should be considered as part of the overall rendering configuration.
Regarding the associated variable GLumenTranslucencyRadianceCacheReflections:
The purpose of GLumenTranslucencyRadianceCacheReflections is to serve as the internal representation of the r.Lumen.TranslucencyReflections.RadianceCache setting within the C++ code.
This variable is used directly in the Lumen subsystem’s code to determine whether to use the Radiance Cache for translucent reflections. It’s checked in functions like UseLumenTranslucencyRadianceCacheReflections to control the behavior of the rendering system.
The value of this variable is set by the console variable system when r.Lumen.TranslucencyReflections.RadianceCache is modified.
It interacts closely with View.Family->EngineShowFlags.LumenReflections, as seen in the UseLumenTranslucencyRadianceCacheReflections function.
Developers should be aware that this variable is used as a boolean flag (non-zero means enabled), despite being an int32 type.
Best practices include using the provided functions like UseLumenTranslucencyRadianceCacheReflections rather than directly checking the variable, as these functions may include additional logic or checks.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:16
Scope: file
Source code excerpt:
int32 GLumenTranslucencyRadianceCacheReflections = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCache(
TEXT("r.Lumen.TranslucencyReflections.RadianceCache"),
GLumenTranslucencyRadianceCacheReflections,
TEXT("Whether to use the Radiance Cache to provide Lumen Reflections on Translucent Surfaces."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenTranslucencyReflectionsMarkDownsampleFactor = 4;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenTranslucencyRadianceCacheReflections
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:14
Scope: file
Source code excerpt:
#include "LumenRadianceCache.h"
int32 GLumenTranslucencyRadianceCacheReflections = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCache(
TEXT("r.Lumen.TranslucencyReflections.RadianceCache"),
GLumenTranslucencyRadianceCacheReflections,
TEXT("Whether to use the Radiance Cache to provide Lumen Reflections on Translucent Surfaces."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenTranslucencyReflectionsMarkDownsampleFactor = 4;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCacheDownsampleFactor(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:50
Scope (from outer to inner):
file
namespace Lumen
function bool UseLumenTranslucencyRadianceCacheReflections
Source code excerpt:
bool UseLumenTranslucencyRadianceCacheReflections(const FViewInfo& View)
{
return GLumenTranslucencyRadianceCacheReflections != 0 && View.Family->EngineShowFlags.LumenReflections;
}
bool ShouldRenderInTranslucencyRadianceCacheMarkPass(bool bShouldRenderInMainPass, const FMaterial& Material)
{
const bool bIsTranslucent = IsTranslucentBlendMode(Material);
const ETranslucencyLightingMode TranslucencyLightingMode = Material.GetTranslucencyLightingMode();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:309
Scope: file
Source code excerpt:
const LumenRadianceCache::FRadianceCacheMarkParameters& RadianceCacheMarkParameters)
{
check(GLumenTranslucencyRadianceCacheReflections != 0);
const EMeshPass::Type MeshPass = EMeshPass::LumenTranslucencyRadianceCacheMark;
const float ViewportScale = 1.0f / GLumenTranslucencyReflectionsMarkDownsampleFactor;
FIntRect DownsampledViewRect = GetScaledRect(View.ViewRect, ViewportScale);
View.BeginRenderView();