r.Filter.SizeScale
r.Filter.SizeScale
#Overview
name: r.Filter.SizeScale
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:
Allows to scale down or up the sample count used for bloom and Gaussian depth of field (scale is clamped to give reasonable results).\nValues down to 0.6 are hard to notice\n 1 full quality (default)\n >1 more samples (slower)\n <1 less samples (faster, artifacts with HDR content or boxy results with GaussianDOF)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Filter.SizeScale is to control the sample count used for bloom and Gaussian depth of field effects in Unreal Engine’s rendering system. This setting variable allows developers to scale up or down the number of samples used in these post-processing effects, affecting both quality and performance.
This setting variable is primarily used within the Renderer module of Unreal Engine, specifically in the post-processing subsystem. It’s referenced in the PostProcessWeightedSampleSum.cpp file, which handles various post-processing effects.
The value of this variable is set through a console variable (CVarFilterSizeScale) with a default value of 1.0. It can be modified at runtime through console commands or programmatically.
The r.Filter.SizeScale interacts directly with the CVarFilterSizeScale variable, which is an instance of TAutoConsoleVariable
Developers should be aware of the following when using this variable:
- The scale affects both bloom and Gaussian depth of field effects.
- Values below 1.0 reduce sample count, improving performance but potentially introducing artifacts.
- Values above 1.0 increase sample count, potentially improving quality but at the cost of performance.
- The actual applied scale is clamped between 0.1 and 10.0 to ensure reasonable results.
Best practices for using this variable include:
- Use the default value of 1.0 for standard quality.
- For performance optimization, consider values down to 0.6, as differences below this are hard to notice.
- For higher quality renders or screenshots, values above 1.0 can be used, but be mindful of the performance impact.
- When adjusting this value, always test with various scenes and lighting conditions to ensure acceptable visual quality.
Regarding the associated variable CVarFilterSizeScale: The purpose of CVarFilterSizeScale is to provide a programmable interface to the r.Filter.SizeScale setting. It allows the engine to access and modify the filter size scale value at runtime.
This variable is used directly in the rendering code to retrieve the current scale value and apply it to the filter calculations. It’s defined as a TAutoConsoleVariable, which means it can be modified through console commands or programmatically during runtime.
Developers should be aware that changes to CVarFilterSizeScale will immediately affect the rendering pipeline. The value is retrieved on the render thread, ensuring thread-safe access.
Best practices for using CVarFilterSizeScale include:
- Use GetValueOnRenderThread() when accessing the value in render thread code.
- Be cautious when modifying this value frequently, as it can impact frame-to-frame consistency.
- Consider exposing this variable in graphics settings menus to allow users to fine-tune performance vs. quality.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:405, section: [PostProcessQuality@0]
- INI Section:
PostProcessQuality@0
- Raw value:
0.6
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:425, section: [PostProcessQuality@1]
- INI Section:
PostProcessQuality@1
- Raw value:
0.7
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:458, section: [PostProcessQuality@2]
- INI Section:
PostProcessQuality@2
- Raw value:
0.8
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:493, section: [PostProcessQuality@3]
- INI Section:
PostProcessQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:531, section: [PostProcessQuality@Cine]
- INI Section:
PostProcessQuality@Cine
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessWeightedSampleSum.cpp:32
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<float> CVarFilterSizeScale(
TEXT("r.Filter.SizeScale"),
1.0f,
TEXT("Allows to scale down or up the sample count used for bloom and Gaussian depth of field (scale is clamped to give reasonable results).\n")
TEXT("Values down to 0.6 are hard to notice\n")
TEXT(" 1 full quality (default)\n")
TEXT(" >1 more samples (slower)\n")
TEXT(" <1 less samples (faster, artifacts with HDR content or boxy results with GaussianDOF)"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessWeightedSampleSum.cpp:106
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
// Constant is tweaked give a similar look to UE before we fixed the scale bug (Some content tweaking might be needed).
// The value defines how much of the Gaussian clipped by the sample window.
// r.Filter.SizeScale allows to tweak that for performance/quality.
const float LegacyCompatibilityConstant = -16.7f;
const float Gaussian = FMath::Exp(LegacyCompatibilityConstant * FMath::Square(DX / Sigma));
return FMath::Lerp(Gaussian, ClampedOneMinusDX, CrossCenterWeight);
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarFilterSizeScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessWeightedSampleSum.cpp:31
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarFilterSizeScale(
TEXT("r.Filter.SizeScale"),
1.0f,
TEXT("Allows to scale down or up the sample count used for bloom and Gaussian depth of field (scale is clamped to give reasonable results).\n")
TEXT("Values down to 0.6 are hard to notice\n")
TEXT(" 1 full quality (default)\n")
TEXT(" >1 more samples (slower)\n")
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessWeightedSampleSum.cpp:148
Scope (from outer to inner):
file
function uint32 Compute1DGaussianFilterKernel
Source code excerpt:
uint32 Compute1DGaussianFilterKernel(FVector2f OutOffsetAndWeight[MAX_FILTER_SAMPLES], uint32 SampleCountMax, float KernelRadius, float CrossCenterWeight)
{
const float FilterSizeScale = FMath::Clamp(CVarFilterSizeScale.GetValueOnRenderThread(), 0.1f, 10.0f);
const float ClampedKernelRadius = GetClampedKernelRadius(SampleCountMax, KernelRadius);
const int32 IntegerKernelRadius = GetIntegerKernelRadius(SampleCountMax, KernelRadius * FilterSizeScale);
uint32 SampleCount = 0;