r.Refraction.Blur.MaxExposedLuminance
r.Refraction.Blur.MaxExposedLuminance
#Overview
name: r.Refraction.Blur.MaxExposedLuminance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Clamp scene pre-exposed luminance to this maximum value. It helps to reduce bright specular highlight flickering, even when r.Refraction.Blur.TemporalAA=1.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Refraction.Blur.MaxExposedLuminance is to control the maximum exposed luminance value used in the refraction blur effect of Unreal Engine’s rendering system. This setting is specifically designed to help reduce flickering in bright specular highlights during refraction rendering.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the distortion rendering subsystem. The code references are found in the DistortionRendering.cpp file, which is part of the core rendering pipeline.
The value of this variable is set as a console variable with a default value of 10.0f. It can be modified at runtime through the console or programmatically. The variable is defined using the TAutoConsoleVariable template, which allows for easy access and modification of the value.
The associated variable CVarRefractionBlurMaxExposedLuminance directly interacts with r.Refraction.Blur.MaxExposedLuminance. They share the same value and purpose.
Developers must be aware that this variable affects the visual quality of refractive materials in the scene. Setting it too low might result in loss of detail in bright areas, while setting it too high might not effectively reduce the flickering of specular highlights.
Best practices when using this variable include:
- Adjusting it based on the specific lighting conditions of your scene.
- Testing different values to find the right balance between reducing flickering and maintaining visual quality.
- Considering the performance impact, as it’s marked with ECVF_Scalability flag.
- Using it in conjunction with other refraction-related settings for optimal results.
Regarding the associated variable CVarRefractionBlurMaxExposedLuminance:
The purpose of CVarRefractionBlurMaxExposedLuminance is identical to r.Refraction.Blur.MaxExposedLuminance. It’s the C++ variable that directly controls the console variable.
This variable is used in the same Renderer module and distortion rendering subsystem as r.Refraction.Blur.MaxExposedLuminance.
The value of CVarRefractionBlurMaxExposedLuminance is set when the console variable is initialized, and it’s accessed in the rendering code using the GetValueOnRenderThread() method.
CVarRefractionBlurMaxExposedLuminance interacts directly with the FMath::Max function to ensure the value used is never negative.
Developers should be aware that this is the actual variable used in the rendering code, so any changes to the console variable will be reflected through this C++ variable.
Best practices for CVarRefractionBlurMaxExposedLuminance include:
- Accessing it using GetValueOnRenderThread() when used in rendering code to ensure thread safety.
- Considering caching its value if used frequently in performance-critical sections of code.
- Being cautious when modifying it directly, as it’s generally meant to be controlled via the console variable system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistortionRendering.cpp:53
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarRefractionBlurMaxExposedLuminance(
TEXT("r.Refraction.Blur.MaxExposedLuminance"),
10.0f,
TEXT("Clamp scene pre-exposed luminance to this maximum value. It helps to reduce bright specular highlight flickering, even when r.Refraction.Blur.TemporalAA=1."),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRefractionUseAVSM(
TEXT("r.HeterogeneousVolumes.CompositeWithTranslucency.Refraction.UseAVSM"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRefractionBlurMaxExposedLuminance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistortionRendering.cpp:52
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarRefractionBlurMaxExposedLuminance(
TEXT("r.Refraction.Blur.MaxExposedLuminance"),
10.0f,
TEXT("Clamp scene pre-exposed luminance to this maximum value. It helps to reduce bright specular highlight flickering, even when r.Refraction.Blur.TemporalAA=1."),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRefractionUseAVSM(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistortionRendering.cpp:331
Scope (from outer to inner):
file
function static void AddCopySceneColorDepthPass
Source code excerpt:
PassParameters->RenderTargets[0] = FRenderTargetBinding(SceneColorCopyTexture, ERenderTargetLoadAction::ENoAction);
PassParameters->RenderTargets[1] = FRenderTargetBinding(SceneDepthCopyTexture, ERenderTargetLoadAction::ENoAction);
PassParameters->MaxExposedLuminance = FMath::Max(0.0f, CVarRefractionBlurMaxExposedLuminance.GetValueOnRenderThread());
// The scene color is copied into from multi-view-rect layout into a single-rect layout.
FIntRect ViewRect;
ViewRect.Min = FIntPoint(0, 0);
ViewRect.Max = FIntPoint(View.ViewRect.Width(), View.ViewRect.Height());