PreTonemapHDRColor

PreTonemapHDRColor

#Overview

name: PreTonemapHDRColor

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of PreTonemapHDRColor is to provide access to the scene color before tone mapping is applied in the rendering pipeline. It is primarily used for visualization and post-processing effects in Unreal Engine 5’s rendering system.

This setting variable is utilized by several Unreal Engine subsystems and modules:

  1. The Modeling Components module, specifically in the World Render Capture functionality.
  2. The Renderer module, particularly in post-processing passes and buffer visualization.

The value of this variable is typically set internally by the rendering pipeline. It represents the high dynamic range (HDR) color information of the scene before tone mapping is applied to convert it to a lower dynamic range for display.

PreTonemapHDRColor interacts with other variables in the rendering pipeline, such as:

  1. PostTonemapHDRColor: Represents the scene color after tone mapping.
  2. SceneColor: The main scene color texture.
  3. Other post-processing inputs like SeparateTranslucency and Velocity.

Developers should be aware of the following when using this variable:

  1. It provides access to the raw HDR color data, which can be useful for certain visual effects or analysis.
  2. This variable is specifically intended for buffer visualization and post-processing materials.
  3. It may not be available in all rendering scenarios or configurations.

Best practices when using this variable include:

  1. Use it primarily for debugging, visualization, or specific post-processing effects that require pre-tonemapped data.
  2. Be cautious about performance implications when accessing this data, especially in real-time rendering scenarios.
  3. Ensure that your usage aligns with the intended purpose of buffer visualization or post-processing materials.
  4. When used in custom post-processing materials, consider the performance impact and limit its usage to where it’s absolutely necessary.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2924, section: [Engine.BufferVisualizationMaterials]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Scene/WorldRenderCapture.h:345

Scope (from outer to inner):

file
namespace    UE
namespace    Geometry
function     class MODELINGCOMPONENTS_API FWorldRenderCapture { public: PRAGMA_DISABLE_DEPRECATION_WARNINGS // Silence deprecation warnings for deprecated LastCaptureViewMatrices member in implicit constructors

Source code excerpt:

	/**
	 * The following values for VisualizationMode are supported:
	 *   BaseColor, Metallic, Roughness, Specular, WorldNormal, Opacity, SubsurfaceColor, PreTonemapHDRColor
	 * 
	 * Its not clear where the valid VisualizationMode FNames are defined, it may be in the [Engine.BufferVisualizationMaterials] section of
	 * Config/BaseEngine.ini, which is read by FBufferVisualizationData::Initialize() and called when the engine initializes in UEngine::Init()
	 */
	bool CaptureBufferVisualizationFromPosition(
		const FName& VisualizationMode,
		const FFrame3d& Frame,
		double HorzFOVDegrees,
		double NearPlaneDist,
		FImageAdapter& ResultImageOut,
		const FRenderCaptureConfig& Config = {});

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeBuffer.cpp:349

Scope (from outer to inner):

file
function     FScreenPassTexture AddVisualizeGBufferOverviewPass

Source code excerpt:

		PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SceneColor, Inputs.SceneColor);
		PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SeparateTranslucency, Inputs.SeparateTranslucency);
		PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::PreTonemapHDRColor, Inputs.SceneColorBeforeTonemap);
		PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::PostTonemapHDRColor, Inputs.SceneColorAfterTonemap);
		PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::Velocity, Inputs.Velocity);

		if (View.Family->EngineShowFlags.PathTracing && Inputs.PathTracingResources->bPostProcessEnabled)
		{
			const FPathTracingResources& PathTracingResources = *Inputs.PathTracingResources;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1298

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

			FPostProcessMaterialInputs PassInputs = GetPostProcessMaterialInputs(SceneColor);
			PassSequence.AcceptOverrideIfLastPass(EPass::PostProcessMaterialAfterTonemapping, PassInputs.OverrideOutput);
			PassInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::PreTonemapHDRColor, FScreenPassTexture::CopyFromSlice(GraphBuilder, SceneColorBeforeTonemapSlice));
			PassInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::PostTonemapHDRColor, SceneColorAfterTonemap);
			PassInputs.SceneTextures = GetSceneTextureShaderParameters(Inputs.SceneTextures);

			SceneColor = AddPostProcessMaterialChain(GraphBuilder, View, PassInputs, PostProcessMaterialAfterTonemappingChain);
		}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/PostProcess/PostProcessMaterialInputs.h:25

Scope: file

Source code excerpt:


	// Buffer Visualization Only.
	PreTonemapHDRColor = 2,
	PostTonemapHDRColor = 3,

	// Active if separate velocity pass is used--i.e. not part of base pass; Not active during Replace Tonemap.
	Velocity = 4
};