r.Lumen.Reflections.SpecularScale
r.Lumen.Reflections.SpecularScale
#Overview
name: r.Lumen.Reflections.SpecularScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Non-physically correct Lumen specular reflection scale. Recommended to keep at 1.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Reflections.SpecularScale is to control the scale of specular reflections in Unreal Engine 5’s Lumen global illumination system. It provides a non-physically correct way to adjust the intensity of specular reflections rendered by Lumen.
This setting variable is primarily used by the Lumen Reflections subsystem, which is part of Unreal Engine 5’s advanced rendering module. It’s specifically utilized within the Renderer module, as evidenced by its location in the LumenReflections.cpp file.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1.0f and can be modified at runtime using console commands or through engine configuration files.
The associated variable GLumenReflectionsSpecularScale directly interacts with r.Lumen.Reflections.SpecularScale. This global variable stores the actual value used by the engine when calculating specular reflections in Lumen.
Developers must be aware that this variable allows for non-physically correct adjustments to specular reflections. While it provides flexibility in tuning the visual appearance of reflections, overuse may lead to unrealistic lighting results.
Best practices when using this variable include:
- Keeping the value at 1.0 for physically accurate results.
- Making small adjustments when necessary for artistic purposes.
- Being cautious of extreme values that could lead to unrealistic lighting.
- Considering the impact on overall scene lighting and consistency when modifying this value.
Regarding the associated variable GLumenReflectionsSpecularScale:
The purpose of GLumenReflectionsSpecularScale is to store the actual value of the specular reflection scale used in Lumen calculations. It directly corresponds to the r.Lumen.Reflections.SpecularScale console variable.
This variable is used within the Lumen Reflections subsystem of the Renderer module. It’s accessed through the GetLumenReflectionSpecularScale() function, which ensures the value is never negative.
The value of GLumenReflectionsSpecularScale is set by the engine’s console variable system when r.Lumen.Reflections.SpecularScale is modified.
GLumenReflectionsSpecularScale interacts closely with r.Lumen.Reflections.SpecularScale, essentially serving as its in-memory representation.
Developers should be aware that this variable is thread-safe for render thread access, as indicated by the ECVF_RenderThreadSafe flag in its declaration.
Best practices for GLumenReflectionsSpecularScale include:
- Avoiding direct manipulation of this variable; instead, use the console variable r.Lumen.Reflections.SpecularScale to modify its value.
- When reading the value in code, use the GetLumenReflectionSpecularScale() function to ensure proper clamping.
- Consider the performance implications of frequently changing this value, as it may affect render thread operations.
#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:275
Scope: file
Source code excerpt:
float GLumenReflectionsSpecularScale = 1.f;
FAutoConsoleVariableRef GVarLumenReflectionsSpecularScale(
TEXT("r.Lumen.Reflections.SpecularScale"),
GLumenReflectionsSpecularScale,
TEXT("Non-physically correct Lumen specular reflection scale. Recommended to keep at 1."),
ECVF_RenderThreadSafe);
float GLumenReflectionsContrast = 1.f;
FAutoConsoleVariableRef GVarLumenReflectionsContrast(
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReflectionsSpecularScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:273
Scope: file
Source code excerpt:
);
float GLumenReflectionsSpecularScale = 1.f;
FAutoConsoleVariableRef GVarLumenReflectionsSpecularScale(
TEXT("r.Lumen.Reflections.SpecularScale"),
GLumenReflectionsSpecularScale,
TEXT("Non-physically correct Lumen specular reflection scale. Recommended to keep at 1."),
ECVF_RenderThreadSafe);
float GLumenReflectionsContrast = 1.f;
FAutoConsoleVariableRef GVarLumenReflectionsContrast(
TEXT("r.Lumen.Reflections.Contrast"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:296
Scope (from outer to inner):
file
function float GetLumenReflectionSpecularScale
Source code excerpt:
float GetLumenReflectionSpecularScale()
{
return FMath::Max(GLumenReflectionsSpecularScale, 0.f);
}
float GetLumenReflectionContrast()
{
return FMath::Clamp(GLumenReflectionsContrast, 0.001f, 1.0f);
}