r.WideCustomResolve
r.WideCustomResolve
#Overview
name: r.WideCustomResolve
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Use a wide custom resolve filter when MSAA is enabled0: Disabled [hardware box filter]1: Wide (r=1.25, 12 samples)2: Wider (r=1.4, 16 samples)3: Widest (r=1.5, 20 samples)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.WideCustomResolve is to control the custom resolve filter when Multi-Sample Anti-Aliasing (MSAA) is enabled in the rendering system. It allows developers to choose between different widths of the custom resolve filter, which affects the quality of anti-aliasing in the final rendered image.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the scene rendering process. It’s referenced in the SceneRendering.cpp file, which is a core part of the rendering pipeline.
The value of this variable is set through a console command, as it’s defined using TAutoConsoleVariable. This means it can be changed at runtime, allowing for dynamic adjustments to the rendering quality.
The variable interacts closely with its associated variable CVarWideCustomResolve. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable only has an effect when MSAA is enabled. If the number of MSAA samples is 1 or less, the custom resolve filter is not applied (ResolveWidth is set to 0).
Best practices when using this variable include:
- Only enable it when MSAA is active, as it has no effect otherwise.
- Consider the performance impact of wider filters, as they sample more pixels and may affect rendering speed.
- Test different settings (0, 1, 2, 3) to find the best balance between image quality and performance for your specific use case.
Regarding the associated variable CVarWideCustomResolve:
The purpose of CVarWideCustomResolve is identical to r.WideCustomResolve. It’s the actual console variable that stores the setting value.
This variable is used directly in the rendering code to determine the width of the custom resolve filter. It’s accessed using the GetValueOnRenderThread() method, ensuring thread-safe access to the current value during rendering.
The value of CVarWideCustomResolve is set through the console command system, allowing for real-time adjustments.
Developers should be aware that changes to this variable will take effect immediately on the next frame render, which can be useful for quick iterations when fine-tuning anti-aliasing quality.
Best practices for CVarWideCustomResolve include:
- Use it in conjunction with performance profiling to understand its impact on frame rates.
- Consider exposing it as a user-configurable graphics option for players with varying hardware capabilities.
- Be cautious when changing its value frequently, as it may cause noticeable visual changes during gameplay.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:358
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarWideCustomResolve(
TEXT("r.WideCustomResolve"),
0,
TEXT("Use a wide custom resolve filter when MSAA is enabled")
TEXT("0: Disabled [hardware box filter]")
TEXT("1: Wide (r=1.25, 12 samples)")
TEXT("2: Wider (r=1.4, 16 samples)")
TEXT("3: Widest (r=1.5, 20 samples)"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarWideCustomResolve
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:357
Scope: file
Source code excerpt:
TEXT("The minimum number of draws per cmdlist. If the total number of draws is less than this, then no parallel work will be done at all. This can't always be honored or done correctly."));
static TAutoConsoleVariable<int32> CVarWideCustomResolve(
TEXT("r.WideCustomResolve"),
0,
TEXT("Use a wide custom resolve filter when MSAA is enabled")
TEXT("0: Disabled [hardware box filter]")
TEXT("1: Wide (r=1.25, 12 samples)")
TEXT("2: Wider (r=1.4, 16 samples)")
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:5833
Scope (from outer to inner):
file
lambda-function
Source code excerpt:
RHICmdList.SetScissorRect(true, View.ViewRectWithSecondaryViews.Min.X, View.ViewRectWithSecondaryViews.Min.Y, View.ViewRectWithSecondaryViews.Max.X, View.ViewRectWithSecondaryViews.Max.Y);
int32 ResolveWidth = CVarWideCustomResolve.GetValueOnRenderThread();
if (NumSamples <= 1)
{
ResolveWidth = 0;
}