r.BufferVisualizationDumpFramesAsHDR

r.BufferVisualizationDumpFramesAsHDR

#Overview

name: r.BufferVisualizationDumpFramesAsHDR

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.BufferVisualizationDumpFramesAsHDR is to control whether buffer visualization materials are saved in a High Dynamic Range (HDR) format when dumping frames.

This setting variable is primarily used in the rendering system of Unreal Engine 5, specifically in the post-processing and buffer visualization subsystems. It is also utilized in the Movie Render Pipeline plugin and the high-resolution screenshot functionality.

The value of this variable is set through the console or programmatically. It is initialized as a console variable with a default value of 0, which means it does not override the default save format. Setting it to 1 forces an HDR format for buffer visualization materials.

This variable interacts with other rendering-related variables, such as r.BufferVisualizationDumpFrames and r.SaveEXR.CompressionQuality. It also influences the behavior of high-resolution screenshots and movie pipeline rendering.

Developers should be aware that:

  1. Changing this variable affects the output format of buffer visualization dumps, which can impact file sizes and image quality.
  2. It may have performance implications when enabled, as HDR formats typically require more processing and storage.

Best practices when using this variable include:

  1. Only enable it when HDR output is specifically required for buffer visualization or debugging purposes.
  2. Consider the impact on performance and storage when enabling this option, especially for large-scale or continuous capture scenarios.
  3. Ensure that the rest of the rendering pipeline and output devices support HDR when using this option to get meaningful results.
  4. Reset the variable to its original value after use, especially in movie pipeline scenarios, to avoid unintended side effects in other parts of the engine.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/BufferVisualizationData.cpp:11

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> BufferVisualizationDumpFramesAsHDR(
	TEXT("r.BufferVisualizationDumpFramesAsHDR"),
	0,
	TEXT("When saving out buffer visualization materials in a HDR capable format\n")
	TEXT("0: Do not override default save format.\n")
	TEXT("1: Force HDR format for buffer visualization materials."),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineDeferredPasses.cpp:281

Scope (from outer to inner):

file
function     void UMoviePipelineDeferredPassBase::SetupImpl

Source code excerpt:

	if (bUse32BitPostProcessMaterials)
	{
		IConsoleVariable* DumpFramesCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFramesAsHDR"));
		if (DumpFramesCVar)
		{
			PreviousDumpFramesValue = DumpFramesCVar->GetInt();
			DumpFramesCVar->Set(1, EConsoleVariableFlags::ECVF_SetByConsole);
		}
		

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineDeferredPasses.cpp:360

Scope (from outer to inner):

file
function     void UMoviePipelineDeferredPassBase::TeardownImpl

Source code excerpt:

	if (PreviousDumpFramesValue.IsSet())
	{
		IConsoleVariable* DumpFramesCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFramesAsHDR"));
		if (DumpFramesCVar)
		{
			DumpFramesCVar->Set(PreviousDumpFramesValue.GetValue(),  EConsoleVariableFlags::ECVF_SetByConsole);
		}
		
		IConsoleVariable* ColorFormatCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PostProcessingColorFormat"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HighResScreenshot.cpp:80

Scope (from outer to inner):

file
function     void FHighResScreenshotConfig::PopulateImageTaskParams

Source code excerpt:

void FHighResScreenshotConfig::PopulateImageTaskParams(FImageWriteTask& InOutTask)
{
	static const TConsoleVariableData<int32>* CVarDumpFramesAsHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.BufferVisualizationDumpFramesAsHDR"));

	const bool bCaptureHDREnabledInUI = bCaptureHDR && bDumpBufferVisualizationTargets;

	const bool bLocalCaptureHDR = bCaptureHDREnabledInUI || CVarDumpFramesAsHDR->GetValueOnAnyThread();

	InOutTask.Format = bLocalCaptureHDR ? EImageFormat::EXR : EImageFormat::PNG;

#Loc: <Workspace>/Engine/Source/Runtime/MovieSceneCapture/Private/CompositionGraphCaptureProtocol.cpp:31

Scope (from outer to inner):

file
function     FFrameCaptureViewExtension

Source code excerpt:

	{
		CVarDumpFrames = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFrames"));
		CVarDumpFramesAsHDR = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFramesAsHDR"));
		CVarHDRCompressionQuality = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SaveEXR.CompressionQuality"));

		RestoreDumpHDR = CVarDumpFramesAsHDR->GetInt();
		RestoreHDRCompressionQuality = CVarHDRCompressionQuality->GetInt();

		Disable();

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

Scope (from outer to inner):

file
function     bool IsPostProcessingOutputInHDR

Source code excerpt:

bool IsPostProcessingOutputInHDR()
{
	static const auto CVarDumpFramesAsHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.BufferVisualizationDumpFramesAsHDR"));

	return CVarDumpFramesAsHDR->GetValueOnRenderThread() != 0 || GetHighResScreenshotConfig().bCaptureHDR;
}

bool IsPostProcessingEnabled(const FViewInfo& View)
{