r.DefaultFeature.AutoExposure

r.DefaultFeature.AutoExposure

#Overview

name: r.DefaultFeature.AutoExposure

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DefaultFeature.AutoExposure is to control the default setting for Auto Exposure in Unreal Engine’s rendering system. Auto Exposure, also known as Eye Adaptation, automatically adjusts the exposure of the scene based on the overall brightness.

This setting variable is primarily used by Unreal Engine’s rendering system, specifically the post-processing pipeline. It’s referenced in the Engine and FunctionalTesting modules.

The value of this variable is set as a console variable (CVar) with a default value of 1 (on). It can be overridden by project settings, post-process volumes, camera settings, or game-specific logic.

The associated variable CVarDefaultAutoExposure interacts directly with r.DefaultFeature.AutoExposure, sharing the same value and purpose.

Developers should be aware that:

  1. This setting can be overridden by various in-game mechanisms.
  2. When set to 0 (off), it forces AutoExposureMinBrightness and AutoExposureMaxBrightness to 1, effectively disabling auto exposure.
  3. There’s an additional related variable (r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange) that can extend the default luminance range when auto exposure is enabled.

Best practices when using this variable include:

  1. Consider performance implications, as auto exposure requires an extra rendering pass.
  2. Be cautious when disabling it, as it may affect the visual quality of your scenes, especially those with varying lighting conditions.
  3. Use in conjunction with other post-processing settings for optimal visual results.

Regarding the associated variable CVarDefaultAutoExposure:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:157

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarDefaultAutoExposure(
	TEXT("r.DefaultFeature.AutoExposure"),
	1,
	TEXT("Engine default (project setting) for AutoExposure is (postprocess volume/camera/game setting still can override)\n")
	TEXT(" 0: off, sets AutoExposureMinBrightness and AutoExposureMaxBrightness to 1\n")
	TEXT(" 1: on (default)"));

static TAutoConsoleVariable<int32> CVarDefaultAutoExposureMethod(

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:240

Scope (from outer to inner):

file
function     FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup

Source code excerpt:

FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup()
	: DefaultFeature_AntiAliasing(TEXT("r.AntiAliasingMethod"))
	, DefaultFeature_AutoExposure(TEXT("r.DefaultFeature.AutoExposure"))
	, DefaultFeature_MotionBlur(TEXT("r.DefaultFeature.MotionBlur"))
	, MotionBlurQuality(TEXT("r.MotionBlurQuality"))
	, ScreenSpaceReflectionQuality(TEXT("r.SSR.Quality"))
	, EyeAdaptationQuality(TEXT("r.EyeAdaptationQuality"))
	, ContactShadows(TEXT("r.ContactShadows"))
	, TonemapperGamma(TEXT("r.TonemapperGamma"))

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:481

Scope (from outer to inner):

file
function     FPostProcessSettings::FPostProcessSettings

Source code excerpt:

	AutoExposureHighPercent = 90.0f;

	// 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;

#Associated Variable and Callsites

This variable is associated with another variable named CVarDefaultAutoExposure. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:156

Scope: file

Source code excerpt:

	TEXT(" 1: on (default, costs extra pass, only useful if there is some baked lighting)"));

static TAutoConsoleVariable<int32> CVarDefaultAutoExposure(
	TEXT("r.DefaultFeature.AutoExposure"),
	1,
	TEXT("Engine default (project setting) for AutoExposure is (postprocess volume/camera/game setting still can override)\n")
	TEXT(" 0: off, sets AutoExposureMinBrightness and AutoExposureMaxBrightness to 1\n")
	TEXT(" 1: on (default)"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:1948

Scope (from outer to inner):

file
function     void FSceneView::StartFinalPostprocessSettings

Source code excerpt:

			FinalPostProcessSettings.AmbientOcclusionIntensity = 0;
		}
		if (!CVarDefaultAutoExposure.GetValueOnGameThread())
		{
			FinalPostProcessSettings.AutoExposureMinBrightness = 1;
			FinalPostProcessSettings.AutoExposureMaxBrightness = 1;
			if (CVarDefaultAutoExposureExtendDefaultLuminanceRange.GetValueOnGameThread())
			{
				const float MaxLuminance = 1.2f; // Should we use const LuminanceMaxFromLensAttenuation() instead?