r.DefaultFeature.LocalExposure.HighlightContrastScale

r.DefaultFeature.LocalExposure.HighlightContrastScale

#Overview

name: r.DefaultFeature.LocalExposure.HighlightContrastScale

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.HighlightContrastScale is to control the default value for the Local Exposure Highlight Contrast in Unreal Engine 5’s rendering system. This setting affects the contrast of highlighted areas in the scene when using local exposure.

This setting variable is primarily used by the rendering system, specifically in the post-processing pipeline. It’s part of the Engine module and is referenced in the SceneView component.

The value of this variable is set in two places:

  1. As a console variable (CVar) in Engine/Source/Runtime/Engine/Private/SceneView.cpp with a default value of 1.0f.
  2. In the DefaultEngine.ini file for new projects, set to 0.8 by default.

The associated variable CVarDefaultLocalExposureHighlightContrast interacts directly with r.DefaultFeature.LocalExposure.HighlightContrastScale. It’s used to retrieve the current value of the setting and apply it to the final post-process settings.

Developers should be aware that:

  1. This is a project-level setting that can be overridden by post-process volumes, camera settings, or game-specific settings.
  2. The value is clamped between 0.0 and 1.0 when applied to the final post-process settings.
  3. Changing this value will affect the visual appearance of highlighted areas in the scene.

Best practices when using this variable include:

  1. Adjusting it in conjunction with r.DefaultFeature.LocalExposure.ShadowContrastScale for balanced exposure control.
  2. Testing different values to find the best visual result for your specific project.
  3. Consider exposing this setting to artists or designers for fine-tuning scene appearance.

Regarding the associated variable CVarDefaultLocalExposureHighlightContrast:

The purpose of CVarDefaultLocalExposureHighlightContrast is to provide runtime access and control over the Local Exposure Highlight Contrast scale.

This variable is part of the Engine module and is used directly in the SceneView component of the rendering system.

The value of this variable is set when the engine initializes, based on the r.DefaultFeature.LocalExposure.HighlightContrastScale setting in the configuration files.

It interacts with the FinalPostProcessSettings, specifically setting the LocalExposureHighlightContrastScale property.

Developers should be aware that:

  1. This variable provides real-time control over the highlight contrast scale.
  2. Changes to this variable will immediately affect the rendering output.
  3. The value is clamped between 0.0 and 1.0 when applied.

Best practices when using this variable include:

  1. Use it for runtime adjustments or debugging of local exposure settings.
  2. Consider exposing it through debug menus or console commands for easy tweaking during development.
  3. Be cautious about changing it during gameplay, as it may affect visual consistency.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarDefaultLocalExposureHighlightContrast(
	TEXT("r.DefaultFeature.LocalExposure.HighlightContrastScale"),
	1.0f,
	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,

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

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

		// Enable Local Exposure by default for new projects
		ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
			TEXT("/Script/Engine.RendererSettings"),
			TEXT("r.DefaultFeature.LocalExposure.ShadowContrastScale"),
			TEXT("0.8"),
			false /* ShouldReplaceExistingValue */);
	}

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT(" 1: Extended range (UE5 default)"));

static TAutoConsoleVariable<float> CVarDefaultLocalExposureHighlightContrast(
	TEXT("r.DefaultFeature.LocalExposure.HighlightContrastScale"),
	1.0f,
	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"),

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

Scope (from outer to inner):

file
function     void FSceneView::StartFinalPostprocessSettings

Source code excerpt:


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

			FinalPostProcessSettings.LocalExposureHighlightContrastScale = HighlightContrast;
		}

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