r.DefaultFeature.LocalExposure.ShadowContrastScale

r.DefaultFeature.LocalExposure.ShadowContrastScale

#Overview

name: r.DefaultFeature.LocalExposure.ShadowContrastScale

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DefaultFeature.LocalExposure.ShadowContrastScale is to control the default shadow contrast scale for local exposure in the rendering system of Unreal Engine 5.

This setting variable is primarily used by the rendering subsystem, specifically in the post-processing pipeline for local exposure adjustment. It’s part of the Engine’s renderer settings and affects how shadows are contrasted in the final image.

The value of this variable is set in two places:

  1. As a console variable with a default value of 1.0f in SceneView.cpp.
  2. In the DefaultEngine.ini file with a value of 0.8 when generating a new game project.

The associated variable CVarDefaultLocalExposureShadowContrast interacts directly with r.DefaultFeature.LocalExposure.ShadowContrastScale. They share the same value and purpose.

Developers must be aware that:

  1. This is an engine default setting that can be overridden by post-process volumes, camera settings, or game-specific settings.
  2. The value is clamped between 0.0f and 1.0f when used in the FSceneView::StartFinalPostprocessSettings function.

Best practices when using this variable include:

  1. Adjusting it carefully to achieve the desired shadow contrast in your scenes.
  2. Consider overriding it in specific areas using post-process volumes for more localized control.
  3. Be mindful of how changes to this value affect the overall visual quality and performance of your game.

Regarding the associated variable CVarDefaultLocalExposureShadowContrast:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarDefaultLocalExposureShadowContrast(
	TEXT("r.DefaultFeature.LocalExposure.ShadowContrastScale"),
	1.0f,
	TEXT("Engine default (project setting) for Local Exposure Shadow Contrast (postprocess volume/camera/game setting still can override)\n"));

static TAutoConsoleVariable<int32> CVarDefaultMotionBlur(
	TEXT("r.DefaultFeature.MotionBlur"),
	1,

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:149

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.LocalExposure.ShadowContrastScale"),
			TEXT("0.8"),
			false /* ShouldReplaceExistingValue */);
	}

	/** Get the configuration values for raytracing if enabled. */
	void AddRaytracingConfigValues(const FProjectInformation& InProjectInfo, TArray<FTemplateConfigValue>& ConfigValues)
	{
		if (InProjectInfo.bEnableRaytracing.IsSet() && 
			InProjectInfo.bEnableRaytracing.GetValue() == true)
		{

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("Engine default (project setting) for Local Exposure Highlight Contrast (postprocess volume/camera/game setting still can override)\n"));

static TAutoConsoleVariable<float> CVarDefaultLocalExposureShadowContrast(
	TEXT("r.DefaultFeature.LocalExposure.ShadowContrastScale"),
	1.0f,
	TEXT("Engine default (project setting) for Local Exposure Shadow Contrast (postprocess volume/camera/game setting still can override)\n"));

static TAutoConsoleVariable<int32> CVarDefaultMotionBlur(
	TEXT("r.DefaultFeature.MotionBlur"),

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

Scope (from outer to inner):

file
function     void FSceneView::StartFinalPostprocessSettings

Source code excerpt:


		{
			const float ShadowContrast = FMath::Clamp(CVarDefaultLocalExposureShadowContrast.GetValueOnGameThread(), 0.0f, 1.0f);

			FinalPostProcessSettings.LocalExposureShadowContrastScale = ShadowContrast;
		}

		if (!CVarDefaultMotionBlur.GetValueOnGameThread())
		{