r.SceneColorFormat
r.SceneColorFormat
#Overview
name: r.SceneColorFormat
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Defines the memory layout (RGBA) used for the scene color\n(affects performance, mostly through bandwidth, quality especially with translucency).\n 0: PF_B8G8R8A8 32Bit (mostly for testing, likely to unusable with HDR)\n 1: PF_A2B10G10R10 32Bit\n 2: PF_FloatR11G11B10 32Bit\n 3: PF_FloatRGB 32Bit\n 4: PF_FloatRGBA 64Bit (default, might be overkill, especially if translucency is mostly using SeparateTranslucency)\n 5: PF_A32B32G32R32F 128Bit (unreasonable but good for testing)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SceneColorFormat is to define the memory layout (RGBA) used for the scene color in Unreal Engine’s rendering system. This setting variable affects performance, primarily through bandwidth usage, and quality, especially with translucency effects.
This setting variable is primarily used by Unreal Engine’s rendering subsystem. Based on the callsites, it’s referenced in core engine components related to rendering, viewport management, and high-resolution screenshot functionality.
The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable in the ConsoleManager.cpp file, with a default value of 4.
This variable interacts with other rendering-related variables, particularly r.PostProcessingColorFormat, as seen in the UnrealClient.cpp file where both are modified for high-resolution screenshots.
Developers must be aware that changing this variable can have significant impacts on both performance and visual quality. The chosen format affects memory usage, rendering speed, and the ability to represent high dynamic range (HDR) colors accurately.
Best practices when using this variable include:
- Understanding the trade-offs between different color formats. For example, PF_B8G8R8A8 (value 0) is mostly for testing and likely unusable with HDR.
- Considering the target hardware capabilities when selecting a format.
- Testing thoroughly after changing this setting, as it can affect both performance and visual quality.
- Being cautious when modifying this value at runtime, as it can have far-reaching effects on the rendering pipeline.
- Coordinating changes to this variable with other related rendering settings for optimal results.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:615, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
3
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:642, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
3
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:669, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
3
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:696, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:724, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
4
- Is Array:
False
#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:3669
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSceneColorFormat(
TEXT("r.SceneColorFormat"),
4,
TEXT("Defines the memory layout (RGBA) used for the scene color\n"
"(affects performance, mostly through bandwidth, quality especially with translucency).\n"
" 0: PF_B8G8R8A8 32Bit (mostly for testing, likely to unusable with HDR)\n"
" 1: PF_A2B10G10R10 32Bit\n"
" 2: PF_FloatR11G11B10 32Bit\n"
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneTexturesConfig.cpp:97
Scope (from outer to inner):
file
function static EPixelFormat GetSceneColorFormat
Source code excerpt:
EPixelFormat Format = PF_FloatRGBA;
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SceneColorFormat"));
switch (CVar->GetValueOnAnyThread())
{
case 0:
Format = PF_R8G8B8A8; break;
case 1:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealClient.cpp:1443
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();