r.PostProcessingColorFormat
r.PostProcessingColorFormat
#Overview
name: r.PostProcessingColorFormat
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Defines the memory layout (RGBA) used for most of the post processing chain buffers.\n 0: Default\n 1: Force PF_A32B32G32R32F 128Bit (unreasonable but good for testing)
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PostProcessingColorFormat is to define the memory layout (RGBA) used for most of the post-processing chain buffers in Unreal Engine’s rendering system. It allows developers to control the color format used in post-processing operations.
This setting variable is primarily used by the Unreal Engine’s rendering system, specifically in the post-processing pipeline. It’s also utilized in the Movie Render Pipeline plugin for high-quality offline rendering.
The value of this variable is set through the console variable system. It can be set programmatically or through the console. The default value is 0, which uses the default color format. Setting it to 1 forces the use of PF_A32B32G32R32F (128-bit) format.
The associated variable CVarPostProcessingColorFormat interacts directly with r.PostProcessingColorFormat. They share the same value and are used interchangeably in the code.
Developers should be aware that:
- Changing this variable affects the memory usage and potentially the performance of the rendering pipeline.
- Setting it to 1 (forcing 128-bit format) is described as “unreasonable but good for testing” in the comments, indicating it’s not intended for regular use.
- This variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, meaning it affects scalability and can be safely changed on the render thread.
Best practices when using this variable include:
- Leave it at the default value (0) for normal operation.
- Use the 128-bit format (1) only for testing or when absolutely necessary for higher precision.
- Be aware of the performance implications when changing this value, especially in performance-critical scenarios.
Regarding the associated variable CVarPostProcessingColorFormat:
- It serves the same purpose as r.PostProcessingColorFormat.
- It’s used internally in the engine to access the value of the console variable.
- Developers should generally interact with r.PostProcessingColorFormat rather than CVarPostProcessingColorFormat directly.
- It’s used in the OverridePostProcessingColorFormat function to determine whether to force the 128-bit format.
When working with either variable, developers should consider the impact on memory usage, rendering quality, and performance, and use the higher precision format only when necessary.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3692
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarPostProcessingColorFormat(
TEXT("r.PostProcessingColorFormat"),
0,
TEXT("Defines the memory layout (RGBA) used for most of the post processing chain buffers.\n"
" 0: Default\n"
" 1: Force PF_A32B32G32R32F 128Bit (unreasonable but good for testing)"),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineDeferredPasses.cpp:288
Scope (from outer to inner):
file
function void UMoviePipelineDeferredPassBase::SetupImpl
Source code excerpt:
}
IConsoleVariable* ColorFormatCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PostProcessingColorFormat"));
if (ColorFormatCVar)
{
PreviousColorFormatValue = ColorFormatCVar->GetInt();
ColorFormatCVar->Set(1, EConsoleVariableFlags::ECVF_SetByConsole);
}
}
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineDeferredPasses.cpp:366
Scope (from outer to inner):
file
function void UMoviePipelineDeferredPassBase::TeardownImpl
Source code excerpt:
}
IConsoleVariable* ColorFormatCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PostProcessingColorFormat"));
if (ColorFormatCVar)
{
ColorFormatCVar->Set(PreviousColorFormatValue.GetValue(), EConsoleVariableFlags::ECVF_SetByConsole);
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealClient.cpp:1444
Scope (from outer to inner):
file
function void FViewport::HighResScreenshot
Source code excerpt:
// Forcing 128-bit rendering pipeline
static IConsoleVariable* SceneColorFormatVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SceneColorFormat"));
static IConsoleVariable* PostColorFormatVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PostProcessingColorFormat"));
static IConsoleVariable* ForceLODVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.ForceLOD"));
check(SceneColorFormatVar && PostColorFormatVar);
const int32 OldSceneColorFormat = SceneColorFormatVar->GetInt();
const int32 OldPostColorFormat = PostColorFormatVar->GetInt();
const int32 OldForceLOD = ForceLODVar ? ForceLODVar->GetInt() : -1;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeBuffer.cpp:299
Scope (from outer to inner):
file
function EPixelFormat OverridePostProcessingColorFormat
Source code excerpt:
EPixelFormat OutputFormat = InFormat;
static const auto CVarPostProcessingColorFormat = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PostProcessingColorFormat"));
if (CVarPostProcessingColorFormat && CVarPostProcessingColorFormat->GetValueOnRenderThread() == 1)
{
if (OutputFormat == PF_FloatRGBA)
{
OutputFormat = PF_A32B32G32R32F;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeBuffer.cpp:324
Scope (from outer to inner):
file
function FScreenPassTexture AddVisualizeGBufferOverviewPass
Source code excerpt:
FScreenPassTexture Output;
// Respect the r.PostProcessingColorFormat cvar just like the main rendering path
const EPixelFormat OutputFormat = OverridePostProcessingColorFormat(Inputs.bOutputInHDR ? PF_FloatRGBA : PF_Unknown);
TArray<FVisualizeBufferTile> Tiles;
RDG_EVENT_SCOPE(GraphBuilder, "VisualizeGBufferOverview");
#Associated Variable and Callsites
This variable is associated with another variable named CVarPostProcessingColorFormat
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3691
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarPostProcessingColorFormat(
TEXT("r.PostProcessingColorFormat"),
0,
TEXT("Defines the memory layout (RGBA) used for most of the post processing chain buffers.\n"
" 0: Default\n"
" 1: Force PF_A32B32G32R32F 128Bit (unreasonable but good for testing)"),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeBuffer.cpp:299
Scope (from outer to inner):
file
function EPixelFormat OverridePostProcessingColorFormat
Source code excerpt:
EPixelFormat OutputFormat = InFormat;
static const auto CVarPostProcessingColorFormat = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PostProcessingColorFormat"));
if (CVarPostProcessingColorFormat && CVarPostProcessingColorFormat->GetValueOnRenderThread() == 1)
{
if (OutputFormat == PF_FloatRGBA)
{
OutputFormat = PF_A32B32G32R32F;
}
}