ShowFlag.ToneCurve

ShowFlag.ToneCurve

#Overview

name: ShowFlag.ToneCurve

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 ShowFlag.ToneCurve is to control the post-processing filmic tone curve and gamut expansion in Unreal Engine 5’s rendering pipeline. This setting is part of the post-processing system and affects the final look of the rendered image.

ShowFlag.ToneCurve is primarily used in the Engine’s rendering subsystem, particularly in the post-processing stage. It’s also referenced in the OpenColorIO plugin and the Movie Render Pipeline, indicating its importance in color management and high-quality rendering scenarios.

The value of this variable is typically set through the engine’s show flags system, which allows for runtime toggling of various rendering features. It can be manipulated programmatically or through the engine’s user interface.

This variable interacts closely with the ToneCurveAmount post-processing setting. When ShowFlag.ToneCurve is disabled, the ToneCurveAmount is set to 0, effectively turning off the tone mapping effect.

Developers should be aware that:

  1. Disabling ShowFlag.ToneCurve can affect the overall look of the scene, potentially making it appear flatter or less contrasty.
  2. It’s used in specific rendering scenarios, such as in the OpenColorIO plugin, where it’s deliberately turned off to ensure the input color space is the working space (sRGB linear).
  3. The Movie Render Pipeline uses this flag to determine the type of post-processing output, allowing for HDR output with or without tone curve applied.

Best practices when using this variable include:

  1. Consider the entire rendering pipeline when modifying this flag, as it can have far-reaching effects on the final image.
  2. Use it in conjunction with other post-processing settings for fine-tuned control over the scene’s appearance.
  3. Be cautious when disabling it in scenarios where color accuracy is crucial, such as in color grading workflows.

The associated variable ToneCurve shares the same value and purpose as ShowFlag.ToneCurve. It’s used in similar contexts and follows the same best practices and considerations. The main difference is in how it’s referenced in the code, typically as part of the EngineShowFlags struct rather than as a standalone ShowFlag.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:113

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))
/** Post processing filmic tone curve and expand gamut */
SHOWFLAG_ALWAYS_ACCESSIBLE(ToneCurve, SFG_PostProcess, NSLOCTEXT("UnrealEd", "ToneCurveSF", "Tone Curve"))
/** If Translucency should be rendered into a separate RT and composited without DepthOfField, can be disabled in the materials (affects sorting), SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(SeparateTranslucency, SFG_Advanced, NSLOCTEXT("UnrealEd", "SeparateTranslucencySF", "Separate Translucency"))
/** If Screen Percentage should be applied.  */
SHOWFLAG_ALWAYS_ACCESSIBLE(ScreenPercentage, SFG_Hidden, NSLOCTEXT("UnrealEd", "ScreenPercentageSF", "Screen Percentage"))
/** Helper to tweak motion blur settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionBlur, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeMotionBlurSF", "Motion Blur"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compositing/OpenColorIO/Source/OpenColorIO/Private/OpenColorIORendering.cpp:124

Scope (from outer to inner):

file
function     void FOpenColorIORendering::PrepareView

Source code excerpt:

void FOpenColorIORendering::PrepareView(FSceneViewFamily& InViewFamily, FSceneView& InView)
{
	//Force ToneCurve to be off while we'are alive to make sure the input color space is the working space : srgb linear
	InViewFamily.EngineShowFlags.SetToneCurve(false);
	// This flags sets tonampper to output to ETonemapperOutputDevice::LinearNoToneCurve
	InViewFamily.SceneCaptureSource = SCS_FinalColorHDR;

	InView.FinalPostProcessSettings.bOverride_ToneCurveAmount = 1;
	InView.FinalPostProcessSettings.ToneCurveAmount = 0.0;

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Public/MovieRenderPipelineDataTypes.h:898

Scope: file

Source code excerpt:

	EAntiAliasingMethod AntiAliasingMethod;

	/** What type of output should the Post Processing output? (HDR /w ToneCurve, HDR w/o ToneCurve) */
	ESceneCaptureSource SceneCaptureSource;

	/** How many tiles on X and Y are there total. */
	FIntPoint OriginalTileCounts;

	/** How many tiles on X and Y are there total. */

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

Scope (from outer to inner):

file
function     void FSceneView::EndFinalPostprocessSettings

Source code excerpt:

	}

	if (!Family->EngineShowFlags.ToneCurve)
	{
		FinalPostProcessSettings.ToneCurveAmount = 0;
	}

	{
		float Value = CVarExposureOffset.GetValueOnGameThread();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:113

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))
/** Post processing filmic tone curve and expand gamut */
SHOWFLAG_ALWAYS_ACCESSIBLE(ToneCurve, SFG_PostProcess, NSLOCTEXT("UnrealEd", "ToneCurveSF", "Tone Curve"))
/** If Translucency should be rendered into a separate RT and composited without DepthOfField, can be disabled in the materials (affects sorting), SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(SeparateTranslucency, SFG_Advanced, NSLOCTEXT("UnrealEd", "SeparateTranslucencySF", "Separate Translucency"))
/** If Screen Percentage should be applied.  */
SHOWFLAG_ALWAYS_ACCESSIBLE(ScreenPercentage, SFG_Hidden, NSLOCTEXT("UnrealEd", "ScreenPercentageSF", "Screen Percentage"))
/** Helper to tweak motion blur settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionBlur, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeMotionBlurSF", "Motion Blur"))