r.Lumen.Reflections.MaxRoughnessToTraceForFoliage
r.Lumen.Reflections.MaxRoughnessToTraceForFoliage
#Overview
name: r.Lumen.Reflections.MaxRoughnessToTraceForFoliage
The value of this variable can be defined or overridden in .ini config files. 3
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max roughness value for which Lumen still traces dedicated reflection rays from foliage pixels. Where foliage pixel is a pixel with two sided or subsurface shading model.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Reflections.MaxRoughnessToTraceForFoliage is to control the maximum roughness value for which Lumen will trace dedicated reflection rays from foliage pixels in the rendering system. This setting is specifically for pixels with two-sided or subsurface shading models, which are typically associated with foliage.
This setting variable is primarily used in the Lumen Reflections subsystem of Unreal Engine’s rendering module. It’s part of the Lumen global illumination system, which is responsible for real-time dynamic global illumination and reflections.
The value of this variable is set through a console variable (CVar) named CVarLumenReflectionsMaxRoughnessToTraceForFoliage. It’s initialized with a default value of 0.2f, but can be changed at runtime through console commands or project settings.
This variable interacts with other reflection-related variables in the Lumen system, particularly those controlling roughness thresholds for reflection tracing. It’s used in conjunction with the general MaxRoughnessToTrace parameter but provides a separate threshold specifically for foliage.
Developers should be aware that this variable affects performance and visual quality. Higher values will result in more accurate reflections on foliage at the cost of performance, while lower values will improve performance but may reduce reflection quality on rougher foliage surfaces.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project’s foliage.
- Balancing it with other Lumen reflection settings for optimal performance and visual quality.
- Testing different values to find the sweet spot between performance and visual fidelity for your specific use case.
Regarding the associated variable CVarLumenReflectionsMaxRoughnessToTraceForFoliage:
This is the actual console variable that controls the r.Lumen.Reflections.MaxRoughnessToTraceForFoliage setting. It’s defined as a TAutoConsoleVariable
The purpose of this variable is the same as r.Lumen.Reflections.MaxRoughnessToTraceForFoliage - to control the maximum roughness for foliage reflection tracing in Lumen.
This variable is used in the LumenReflections subsystem, specifically in the SetupCompositeParameters function. Its value is retrieved using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.
Developers should be aware that changes to this console variable will take effect immediately in the render thread. It’s marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it affects scalability and is safe to modify from the render thread.
Best practices for using this console variable include:
- Using it for fine-tuning reflection quality on foliage during development.
- Considering its impact on performance when adjusting it.
- Potentially exposing it as a user-configurable setting for different quality presets in your game.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:359, section: [ReflectionQuality@2]
- INI Section:
ReflectionQuality@2
- Raw value:
0.2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:369, section: [ReflectionQuality@3]
- INI Section:
ReflectionQuality@3
- Raw value:
0.4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:379, section: [ReflectionQuality@Cine]
- INI Section:
ReflectionQuality@Cine
- Raw value:
0.4
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:81
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarLumenReflectionsMaxRoughnessToTraceForFoliage(
TEXT("r.Lumen.Reflections.MaxRoughnessToTraceForFoliage"),
0.2f,
TEXT("Max roughness value for which Lumen still traces dedicated reflection rays from foliage pixels. Where foliage pixel is a pixel with two sided or subsurface shading model."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReflectionRoughnessFadeLength = .1f;
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenReflectionsMaxRoughnessToTraceForFoliage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:80
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarLumenReflectionsMaxRoughnessToTraceForFoliage(
TEXT("r.Lumen.Reflections.MaxRoughnessToTraceForFoliage"),
0.2f,
TEXT("Max roughness value for which Lumen still traces dedicated reflection rays from foliage pixels. Where foliage pixel is a pixel with two sided or subsurface shading model."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:318
Scope (from outer to inner):
file
function void LumenReflections::SetupCompositeParameters
Source code excerpt:
OutParameters.MaxRoughnessToTrace = FMath::Min(View.FinalPostProcessSettings.LumenMaxRoughnessToTraceReflections, CVarLumenReflectionMaxRoughnessToTraceClamp.GetValueOnRenderThread());
OutParameters.InvRoughnessFadeLength = 1.0f / FMath::Clamp(GLumenReflectionRoughnessFadeLength, 0.001f, 1.0f);
OutParameters.MaxRoughnessToTraceForFoliage = CVarLumenReflectionsMaxRoughnessToTraceForFoliage.GetValueOnRenderThread();
if (CVarLumenReflectionMaxRoughnessToTrace.GetValueOnRenderThread() >= 0.0f)
{
OutParameters.MaxRoughnessToTrace = CVarLumenReflectionMaxRoughnessToTrace.GetValueOnRenderThread();
}
}