r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange
#Overview
name: r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether the default values for AutoExposure should support an extended range of scene luminance.\nThis also change the PostProcessSettings.Exposure.MinBrightness, MaxBrightness, HistogramLogMin and HisogramLogMax\nto be expressed in EV100 values instead of in Luminance and Log2 Luminance.\n 0: Legacy range (UE4 default)\n 1: Extended range (UE5 default)
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange is to control whether the default values for AutoExposure should support an extended range of scene luminance. This setting is primarily used in the rendering system, specifically for auto-exposure and post-processing effects.
This setting variable is relied upon by several Unreal Engine subsystems and modules, including:
- The Renderer module
- The Engine module
- The GameProjectGeneration module
- The DetailCustomizations module
The value of this variable is set in multiple places:
- It is initially defined as a console variable with a default value of 0.
- It can be set in the project’s DefaultEngine.ini file.
- It can be modified at runtime through the console or in C++ code.
This variable interacts with several other variables and settings, including:
- PostProcessSettings.Exposure settings (MinBrightness, MaxBrightness, HistogramLogMin, HistogramLogMax)
- AutoExposureBias
- Other auto-exposure related console variables
Developers must be aware of the following when using this variable:
- When enabled (set to 1), it changes how certain exposure values are interpreted. They become expressed in EV100 values instead of Luminance and Log2 Luminance.
- It affects the default values for auto-exposure settings in new projects.
- It can impact the visual appearance of scenes due to the changed luminance range.
Best practices when using this variable include:
- Consider the target platform and desired visual style when deciding whether to enable the extended luminance range.
- Be consistent in its usage across a project to avoid unexpected visual discrepancies.
- When enabled, remember to adjust related exposure settings accordingly, as their interpretation changes.
Regarding the associated variable CVarDefaultAutoExposureExtendDefaultLuminanceRange:
This is the actual console variable object that stores the value of r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange. It’s used internally by the engine to access and modify the setting. The purpose and usage are the same as described for r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange.
Developers should be aware that when accessing this setting in C++ code, they should use CVarDefaultAutoExposureExtendDefaultLuminanceRange rather than trying to access r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange directly. The best practice is to use the provided console variable interfaces (like GetValueOnGameThread() or GetValueOnRenderThread()) to read its value, ensuring thread-safe access in different contexts.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:103, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:176
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDefaultAutoExposureExtendDefaultLuminanceRange(
TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"),
0,
TEXT("Whether the default values for AutoExposure should support an extended range of scene luminance.\n")
TEXT("This also change the PostProcessSettings.Exposure.MinBrightness, MaxBrightness, HistogramLogMin and HisogramLogMax\n")
TEXT("to be expressed in EV100 values instead of in Luminance and Log2 Luminance.\n")
TEXT(" 0: Legacy range (UE4 default)\n")
TEXT(" 1: Extended range (UE5 default)"));
#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/PostProcessSettingsCustomization.cpp:146
Scope (from outer to inner):
file
function void FPostProcessSettingsCustomization::CustomizeChildren
Source code excerpt:
TMap<FString, FPostProcessGroup> NameToGroupMap;
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
const bool bExtendedLuminanceRange = VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnGameThread() == 1;
static const FName ExposureCategory("Lens|Exposure");
bool bShowPostProcessCategories = StructPropertyHandle->HasMetaData(ShowPostProcessCategoriesName);
#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:135
Scope (from outer to inner):
file
namespace anonymous
function void AddPostProcessingConfigValues
Source code excerpt:
ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
TEXT("/Script/Engine.RendererSettings"),
TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"),
TEXT("True"),
false /* ShouldReplaceExistingValue */);
// Enable Local Exposure by default for new projects
ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
TEXT("/Script/Engine.RendererSettings"),
TEXT("r.DefaultFeature.LocalExposure.HighlightContrastScale"),
TEXT("0.8"),
false /* ShouldReplaceExistingValue */);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:195
Scope (from outer to inner):
file
function FCameraExposureSettings::FCameraExposureSettings
Source code excerpt:
FCameraExposureSettings::FCameraExposureSettings()
{
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
const bool bExtendedLuminanceRange = VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnAnyThread() == 1;
static const auto VarDefaultAutoExposureBias = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.DefaultFeature.AutoExposure.Bias"));
const float BaseAutoExposureBias = VarDefaultAutoExposureBias->GetValueOnAnyThread();
// next value might get overwritten by r.DefaultFeature.AutoExposure.Method
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:482
Scope (from outer to inner):
file
function FPostProcessSettings::FPostProcessSettings
Source code excerpt:
// next value might get overwritten by r.DefaultFeature.AutoExposure
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
if (VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnAnyThread() != 0)
{
// When this project setting is set, the following values are in EV100.
AutoExposureMinBrightness = -10.0f;
AutoExposureMaxBrightness = 20.0f;
HistogramLogMin = -10.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:815
Scope (from outer to inner):
file
function void FPostProcessSettings::PostSerialize
Source code excerpt:
if (bIsAnyNonDefault)
{
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
bool bExtendedLuminanceRange = (VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnAnyThread() == 1);
const float ExtraAutoExposureBias = CalculateEyeAdaptationExposureVersionUpdate(*this, bExtendedLuminanceRange);
AutoExposureBias += ExtraAutoExposureBias;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:871
Scope (from outer to inner):
file
function void FPostProcessSettings::PostSerialize
Source code excerpt:
if (bIsAnyNonDefault)
{
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
bool bExtendedLuminanceRange = (VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnAnyThread() == 1);
const float ExtraAutoExposureBias = CalculateEyeAdaptationExposureVersionUpdate(*this, bExtendedLuminanceRange);
static const auto VarDefaultAutoExposureBias = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.DefaultFeature.AutoExposure.Bias"));
const float BaseAutoExposureBias = VarDefaultAutoExposureBias->GetValueOnAnyThread();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:184
Scope (from outer to inner):
file
function bool IsExtendLuminanceRangeEnabled
Source code excerpt:
bool IsExtendLuminanceRangeEnabled()
{
static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));
return VarDefaultAutoExposureExtendDefaultLuminanceRange->GetValueOnRenderThread() == 1;
}
bool IsAutoExposureUsingIlluminanceEnabled(const FViewInfo& View)
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarDefaultAutoExposureExtendDefaultLuminanceRange
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:175
Scope: file
Source code excerpt:
TEXT("Engine default (project setting) for AutoExposure Exposure Bias (postprocess volume/camera/game setting still can override)\n"));
static TAutoConsoleVariable<int32> CVarDefaultAutoExposureExtendDefaultLuminanceRange(
TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"),
0,
TEXT("Whether the default values for AutoExposure should support an extended range of scene luminance.\n")
TEXT("This also change the PostProcessSettings.Exposure.MinBrightness, MaxBrightness, HistogramLogMin and HisogramLogMax\n")
TEXT("to be expressed in EV100 values instead of in Luminance and Log2 Luminance.\n")
TEXT(" 0: Legacy range (UE4 default)\n")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:1952
Scope (from outer to inner):
file
function void FSceneView::StartFinalPostprocessSettings
Source code excerpt:
FinalPostProcessSettings.AutoExposureMinBrightness = 1;
FinalPostProcessSettings.AutoExposureMaxBrightness = 1;
if (CVarDefaultAutoExposureExtendDefaultLuminanceRange.GetValueOnGameThread())
{
const float MaxLuminance = 1.2f; // Should we use const LuminanceMaxFromLensAttenuation() instead?
FinalPostProcessSettings.AutoExposureMinBrightness = LuminanceToEV100(MaxLuminance, FinalPostProcessSettings.AutoExposureMinBrightness);
FinalPostProcessSettings.AutoExposureMaxBrightness = LuminanceToEV100(MaxLuminance, FinalPostProcessSettings.AutoExposureMaxBrightness);
}
}