r.SSGI.LeakFreeReprojection
r.SSGI.LeakFreeReprojection
#Overview
name: r.SSGI.LeakFreeReprojection
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether use a more expensive but leak free reprojection of previous frame\'s scene color.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SSGI.LeakFreeReprojection is to control whether to use a more expensive but leak-free reprojection of the previous frame’s scene color in Screen Space Global Illumination (SSGI).
This setting variable is primarily used in the rendering system, specifically for the Screen Space Global Illumination feature. It is part of the Renderer module in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the rendering system, particularly the Screen Space Ray Tracing component. This can be inferred from the file location (ScreenSpaceRayTracing.cpp) and the namespace (ScreenSpaceRayTracing) where it’s used.
The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of 1, meaning the leak-free reprojection is enabled by default.
This variable interacts with the associated variable CVarSSGILeakFreeReprojection, which is the actual console variable object. They share the same value and purpose.
Developers must be aware that enabling this feature (by setting it to 1) will result in a more expensive but higher quality rendering process. It may impact performance, especially on lower-end hardware.
Best practices when using this variable include:
- Consider the performance impact when enabling this feature, especially for games targeting a wide range of hardware.
- Use it in conjunction with other SSGI settings like r.SSGI.Quality for optimal results.
- Allow this setting to be adjustable by users in the graphics options menu for better performance scalability.
Regarding the associated variable CVarSSGILeakFreeReprojection:
The purpose of CVarSSGILeakFreeReprojection is to provide a programmatic way to access and modify the r.SSGI.LeakFreeReprojection setting within the C++ code.
It is used in the same Unreal Engine subsystem (rendering system) and module (Renderer) as r.SSGI.LeakFreeReprojection.
The value of this variable is set when it’s initialized and can be modified at runtime through console commands or code.
This variable is used directly in the ShouldKeepBleedFreeSceneColor function to determine whether to use the leak-free reprojection feature.
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.
Best practices for using this variable include:
- Access its value using GetValueOnRenderThread() when in render thread context.
- Consider caching the value if it’s accessed frequently to avoid potential performance overhead from repeated console variable lookups.
- Use it in conjunction with other SSGI-related console variables for comprehensive control over the SSGI feature.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:47
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSSGILeakFreeReprojection(
TEXT("r.SSGI.LeakFreeReprojection"), 1,
TEXT("Whether use a more expensive but leak free reprojection of previous frame's scene color.\n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGIQuality(
TEXT("r.SSGI.Quality"), 4,
TEXT("Quality setting to control number of ray shot with SSGI, between 1 and 4 (defaults to 4).\n"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSGILeakFreeReprojection
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:46
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGILeakFreeReprojection(
TEXT("r.SSGI.LeakFreeReprojection"), 1,
TEXT("Whether use a more expensive but leak free reprojection of previous frame's scene color.\n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGIQuality(
TEXT("r.SSGI.Quality"), 4,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:118
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function bool ShouldKeepBleedFreeSceneColor
Source code excerpt:
{
// TODO(Guillaume): SSR as well.
return CVarSSGILeakFreeReprojection.GetValueOnRenderThread() != 0;
}
bool ShouldRenderScreenSpaceReflections(const FViewInfo& View)
{
if(!View.Family->EngineShowFlags.ScreenSpaceReflections
// Note: intentionally allow falling back to SSR from other reflection methods, which may be disabled by scalability