r.DefaultFeature.AutoExposure.Method

r.DefaultFeature.AutoExposure.Method

#Overview

name: r.DefaultFeature.AutoExposure.Method

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.Method is to set the default auto-exposure method for the rendering system in Unreal Engine 5. It controls how the engine calculates and adjusts the exposure of the scene to maintain proper brightness levels.

This setting variable is primarily used by the rendering subsystem of Unreal Engine 5, specifically within the post-processing pipeline. It’s referenced in the Engine module, as seen in the SceneView.cpp and Scene.cpp files.

The value of this variable is set through a console variable (CVar) named CVarDefaultAutoExposureMethod. It’s defined in SceneView.cpp and can be changed at runtime through console commands or project settings.

The r.DefaultFeature.AutoExposure.Method interacts with other auto-exposure related variables, such as AutoExposureLowPercent and AutoExposureHighPercent. It’s also associated with CVarDefaultAutoExposureMethod, which shares the same value.

Developers must be aware that this variable sets the default method, but it can be overridden by post-process volumes, camera settings, or game-specific settings. The available options are: 0: Histogram-based method (default, requires compute shader) 1: Basic auto-exposure method

Best practices when using this variable include:

  1. Consider performance implications when choosing between methods (histogram-based is more complex but potentially more accurate).
  2. Ensure that the chosen method aligns with the visual style and performance requirements of your project.
  3. Remember that this sets the default, but be prepared to override it in specific scenarios where needed.

Regarding the associated variable CVarDefaultAutoExposureMethod:

The purpose of CVarDefaultAutoExposureMethod is to provide a console-accessible way to control the r.DefaultFeature.AutoExposure.Method setting. It’s used internally by the engine to store and retrieve the current auto-exposure method setting.

This variable is part of the Engine module and is primarily used in the rendering subsystem, specifically in the post-processing pipeline.

The value of CVarDefaultAutoExposureMethod is set when defining the console variable in SceneView.cpp. It can be changed at runtime through console commands.

CVarDefaultAutoExposureMethod directly interacts with r.DefaultFeature.AutoExposure.Method, as they share the same value. It’s used in the FSceneView::StartFinalPostprocessSettings function to set the auto-exposure method for the final post-process settings.

Developers should be aware that changing CVarDefaultAutoExposureMethod will affect the global default auto-exposure method. It’s important to use this variable consistently with r.DefaultFeature.AutoExposure.Method to avoid confusion.

Best practices for using CVarDefaultAutoExposureMethod include:

  1. Use it for runtime adjustments or debugging purposes.
  2. Remember that it affects the entire engine’s default behavior, so use with caution in shipping builds.
  3. Consider exposing it through appropriate debugging or configuration interfaces rather than hardcoding changes.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarDefaultAutoExposureMethod(
	TEXT("r.DefaultFeature.AutoExposure.Method"),
	0,
	TEXT("Engine default (project setting) for AutoExposure Method (postprocess volume/camera/game setting still can override)\n")
	TEXT(" 0: Histogram based (requires compute shader, default)\n")
	TEXT(" 1: Basic AutoExposure"));

static TAutoConsoleVariable<float> CVarDefaultAutoExposureBias(

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

Scope (from outer to inner):

file
function     FCameraExposureSettings::FCameraExposureSettings

Source code excerpt:

	const float BaseAutoExposureBias = VarDefaultAutoExposureBias->GetValueOnAnyThread();

	// next value might get overwritten by r.DefaultFeature.AutoExposure.Method
	Method = AEM_Histogram;
	LowPercent = 10.0f;
	HighPercent = 90.0f;

	if (bExtendedLuminanceRange)
	{

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

Scope (from outer to inner):

file
function     FPostProcessSettings::FPostProcessSettings

Source code excerpt:

	CameraISO = 100.f;
	AutoExposureCalibrationConstant_DEPRECATED = 16.f;
	// next value might get overwritten by r.DefaultFeature.AutoExposure.Method
	AutoExposureMethod = AEM_Histogram;
	AutoExposureLowPercent = 10.0f;
	AutoExposureHighPercent = 90.0f;

	// next value might get overwritten by r.DefaultFeature.AutoExposure
	static const auto VarDefaultAutoExposureExtendDefaultLuminanceRange = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT(" 1: on (default)"));

static TAutoConsoleVariable<int32> CVarDefaultAutoExposureMethod(
	TEXT("r.DefaultFeature.AutoExposure.Method"),
	0,
	TEXT("Engine default (project setting) for AutoExposure Method (postprocess volume/camera/game setting still can override)\n")
	TEXT(" 0: Histogram based (requires compute shader, default)\n")
	TEXT(" 1: Basic AutoExposure"));

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

Scope (from outer to inner):

file
function     void FSceneView::StartFinalPostprocessSettings

Source code excerpt:

		else
		{
			int32 Value = CVarDefaultAutoExposureMethod.GetValueOnGameThread();
			if (Value >= 0 && Value < AEM_MAX)
			{
				FinalPostProcessSettings.AutoExposureMethod = (EAutoExposureMethod)Value;
			}
		}