r.SSGI.RejectUncertainRays

r.SSGI.RejectUncertainRays

#Overview

name: r.SSGI.RejectUncertainRays

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.SSGI.RejectUncertainRays is to control the rejection of uncertain screen space rays in the Screen Space Global Illumination (SSGI) system. This setting is part of the rendering system in Unreal Engine 5, specifically related to global illumination calculations.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the ScreenSpaceRayTracing.cpp file within the Runtime/Renderer/Private directory.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is initialized with a default value of 1, meaning that by default, uncertain rays are rejected.

The associated variable CVarSSGIRejectUncertainRays directly interacts with r.SSGI.RejectUncertainRays. They share the same value and purpose.

Developers must be aware that this variable affects the accuracy and performance of the SSGI system. When enabled (set to 1), it rejects screen space rays that are uncertain due to going behind screen geometry. This can improve performance but may affect the quality of global illumination in certain scenarios.

Best practices when using this variable include:

  1. Testing the visual impact of enabling/disabling this feature in different scenes.
  2. Considering the performance implications, especially in complex scenes with many occluded areas.
  3. Balancing this setting with other SSGI-related variables for optimal results.

Regarding the associated variable CVarSSGIRejectUncertainRays:

When working with both r.SSGI.RejectUncertainRays and CVarSSGIRejectUncertainRays, developers should ensure consistent usage across the codebase and consider the impact on both visual quality and performance in their specific use cases.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:62

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSSGIRejectUncertainRays(
	TEXT("r.SSGI.RejectUncertainRays"), 1,
	TEXT("Rejects the screen space ray if it was uncertain due to going behind screen geometry."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSSGITerminateCertainRay(
	TEXT("r.SSGI.TerminateCertainRay"), 1,
	TEXT("Optimisations that if the screen space ray is certain and didn't find any geometry, don't fallback on otehr tracing technic."),

#Associated Variable and Callsites

This variable is associated with another variable named CVarSSGIRejectUncertainRays. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:61

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSSGIRejectUncertainRays(
	TEXT("r.SSGI.RejectUncertainRays"), 1,
	TEXT("Rejects the screen space ray if it was uncertain due to going behind screen geometry."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSSGITerminateCertainRay(
	TEXT("r.SSGI.TerminateCertainRay"), 1,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:247

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     void SetupCommonScreenSpaceRayParameters

Source code excerpt:

	OutParameters->DebugOutput = CreateScreenSpaceRayTracingDebugUAV(GraphBuilder, SceneTextures.SceneDepthTexture->Desc, TEXT("DebugSSRT"));

	OutParameters->bRejectUncertainRays = CVarSSGIRejectUncertainRays.GetValueOnRenderThread() ? 1 : 0;
	OutParameters->bTerminateCertainRay = CVarSSGITerminateCertainRay.GetValueOnRenderThread() ? 1 : 0;
} // SetupCommonScreenSpaceRayParameters()

void SetupCommonScreenSpaceRayParameters(
	FRDGBuilder& GraphBuilder,
	const HybridIndirectLighting::FCommonParameters& CommonDiffuseParameters,