r.Lumen.TranslucencyReflections.MarkDownsampleFactor
r.Lumen.TranslucencyReflections.MarkDownsampleFactor
#Overview
name: r.Lumen.TranslucencyReflections.MarkDownsampleFactor
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Downsample factor for marking translucent surfaces in the Lumen Radiance Cache. Too low of factors will cause incorrect Radiance Cache coverage. Should be a power of 2.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TranslucencyReflections.MarkDownsampleFactor is to control the downsample factor for marking translucent surfaces in the Lumen Radiance Cache within Unreal Engine 5’s rendering system.
This setting variable is primarily used by the Lumen subsystem, specifically for handling translucency reflections in the Radiance Cache. It is part of the rendering module in Unreal Engine 5.
The value of this variable is set through the console variable system, with a default value of 4. It can be changed at runtime using console commands or through project settings.
The associated variable GLumenTranslucencyReflectionsMarkDownsampleFactor directly interacts with this console variable, sharing the same value. This internal variable is used in the actual rendering code to apply the downsample factor.
Developers must be aware of several things when using this variable:
- The value should be a power of 2 for optimal performance and correct results.
- Setting the value too low may cause incorrect Radiance Cache coverage.
- This variable affects the performance and quality trade-off of translucency reflections in Lumen.
Best practices when using this variable include:
- Experiment with different power-of-2 values to find the best balance between performance and visual quality for your specific project.
- Monitor performance impacts when adjusting this value, especially in scenes with complex translucency.
- Consider exposing this setting in your game’s graphics options menu to allow end-users to adjust based on their hardware capabilities.
Regarding the associated variable GLumenTranslucencyReflectionsMarkDownsampleFactor:
- It is an internal integer variable used to store the downsample factor value.
- It is directly used in the rendering code to calculate viewport scaling and HZB mip levels for the Lumen Translucency Radiance Cache marking process.
- When modifying the console variable, this associated variable will automatically update to reflect the new value.
- Developers should not modify this variable directly, but instead use the console variable system to ensure proper synchronization and thread safety.
#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:24
Scope: file
Source code excerpt:
int32 GLumenTranslucencyReflectionsMarkDownsampleFactor = 4;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCacheDownsampleFactor(
TEXT("r.Lumen.TranslucencyReflections.MarkDownsampleFactor"),
GLumenTranslucencyReflectionsMarkDownsampleFactor,
TEXT("Downsample factor for marking translucent surfaces in the Lumen Radiance Cache. Too low of factors will cause incorrect Radiance Cache coverage. Should be a power of 2."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenTranslucencyReflectionsRadianceCacheReprojectionRadiusScale = 10;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenTranslucencyReflectionsMarkDownsampleFactor
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:22
Scope: file
Source code excerpt:
);
int32 GLumenTranslucencyReflectionsMarkDownsampleFactor = 4;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCacheDownsampleFactor(
TEXT("r.Lumen.TranslucencyReflections.MarkDownsampleFactor"),
GLumenTranslucencyReflectionsMarkDownsampleFactor,
TEXT("Downsample factor for marking translucent surfaces in the Lumen Radiance Cache. Too low of factors will cause incorrect Radiance Cache coverage. Should be a power of 2."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenTranslucencyReflectionsRadianceCacheReprojectionRadiusScale = 10;
FAutoConsoleVariableRef CVarLumenTranslucencyRadianceCacheReprojectionRadiusScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:312
Scope: file
Source code excerpt:
const EMeshPass::Type MeshPass = EMeshPass::LumenTranslucencyRadianceCacheMark;
const float ViewportScale = 1.0f / GLumenTranslucencyReflectionsMarkDownsampleFactor;
FIntRect DownsampledViewRect = GetScaledRect(View.ViewRect, ViewportScale);
View.BeginRenderView();
FLumenTranslucencyRadianceCacheMarkParameters* PassParameters = GraphBuilder.AllocParameters<FLumenTranslucencyRadianceCacheMarkParameters>();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:368
Scope: file
Source code excerpt:
float(View.ViewRect.Width()) / float(2 * View.HZBMipmap0Size.X),
float(View.ViewRect.Height()) / float(2 * View.HZBMipmap0Size.Y));
MarkPassParameters.HZBMipLevel = FMath::Max<float>((int32)FMath::FloorLog2((float)GLumenTranslucencyReflectionsMarkDownsampleFactor) - 1, 0.0f);
PassParameters->MarkPass = GraphBuilder.CreateUniformBuffer(&MarkPassParameters);
}
View.ParallelMeshDrawCommandPasses[MeshPass].BuildRenderingCommands(GraphBuilder, SceneRenderer.Scene->GPUScene, PassParameters->InstanceCullingDrawParams);