r.Mobile.EyeAdaptation

r.Mobile.EyeAdaptation

#Overview

name: r.Mobile.EyeAdaptation

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Mobile.EyeAdaptation is to control the eye adaptation feature for mobile platforms in Unreal Engine’s rendering system. Eye adaptation simulates the human eye’s ability to adjust to different light levels, enhancing the visual quality and realism of the rendered scene on mobile devices.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the post-processing pipeline for mobile platforms. It is defined in the PostProcessMobile.cpp file, which suggests it’s tailored for mobile rendering optimizations.

The value of this variable is set through a console variable (CVarMobileEyeAdaptation) with a default value of 1 (enabled). It can be changed at runtime using console commands or through C++ code.

The associated variable CVarMobileEyeAdaptation directly interacts with r.Mobile.EyeAdaptation. They share the same value and purpose, with CVarMobileEyeAdaptation being the actual TAutoConsoleVariable used in the code.

Developers must be aware that this variable is specific to mobile platforms and may not affect desktop or console renderings. It’s also important to note that the eye adaptation feature is only applied when certain conditions are met, as seen in the IsMobileEyeAdaptationEnabled function.

Best practices when using this variable include:

  1. Consider performance implications on lower-end mobile devices when enabling this feature.
  2. Test the visual impact with and without eye adaptation enabled to ensure it enhances the overall visual quality of your mobile game.
  3. Use in conjunction with other mobile-specific rendering settings for optimal results.
  4. Be aware that disabling this feature may require adjustments to your scene lighting to compensate for the lack of automatic exposure adaptation.

Regarding the associated variable CVarMobileEyeAdaptation:

The purpose of CVarMobileEyeAdaptation is to provide a console-accessible way to control the mobile eye adaptation feature. It’s defined as a TAutoConsoleVariable, which allows for runtime modification of the setting.

This variable is used directly in the Renderer module, specifically in the mobile post-processing pipeline. It’s checked in the IsMobileEyeAdaptationEnabled function to determine whether the feature should be applied.

The value of CVarMobileEyeAdaptation is set at initialization with a default of 1 (enabled), but can be changed at runtime through console commands or C++ code.

CVarMobileEyeAdaptation interacts directly with the r.Mobile.EyeAdaptation setting, effectively controlling the same feature.

Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices for using CVarMobileEyeAdaptation include:

  1. Use it for debugging or runtime adjustments of the eye adaptation feature on mobile platforms.
  2. Remember that it affects all views when changed, so use cautiously in multi-view scenarios.
  3. Consider exposing this setting in a developer-only menu for easy testing on mobile devices.
  4. Document any non-default values used in your project for consistency across the development team.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:27

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMobileEyeAdaptation(
	TEXT("r.Mobile.EyeAdaptation"),
	1,
	TEXT("EyeAdaptation for mobile platform.\n")
	TEXT(" 0: Disable\n")
	TEXT(" 1: Enabled (Default)"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:26

Scope: file

Source code excerpt:

	ECVF_ReadOnly);

static TAutoConsoleVariable<int32> CVarMobileEyeAdaptation(
	TEXT("r.Mobile.EyeAdaptation"),
	1,
	TEXT("EyeAdaptation for mobile platform.\n")
	TEXT(" 0: Disable\n")
	TEXT(" 1: Enabled (Default)"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:54

Scope (from outer to inner):

file
function     bool IsMobileEyeAdaptationEnabled

Source code excerpt:

bool IsMobileEyeAdaptationEnabled(const FViewInfo& View)
{
	return View.ViewState != nullptr && View.Family->EngineShowFlags.EyeAdaptation && CVarMobileEyeAdaptation.GetValueOnRenderThread() == 1 && IsMobileHDR();
}

//Following variations are always generated
// 1 = Bloom
// 3 = Bloom + SunShaft
// 5 = Bloom + Dof