r.SSR.TiledComposite

r.SSR.TiledComposite

#Overview

name: r.SSR.TiledComposite

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.SSR.TiledComposite is to enable tiled optimization of the screen space reflection (SSR) in Unreal Engine’s rendering system. This setting variable is part of the engine’s rendering subsystem, specifically related to screen space reflections.

The Unreal Engine’s rendering module relies on this setting variable, as evidenced by its usage in the ScreenSpaceReflectionTiles.cpp file within the Renderer source code.

The value of this variable is set through a console variable (CVarSSRTiledComposite) with a default value of 0, meaning the tiled optimization is disabled by default. Developers can modify this value at runtime or in configuration files.

This variable interacts closely with another variable called CVarSSRTiledCompositeOverrideMaxRoughness, which is used to ignore pixels with roughness larger than a specified value in the tiled SSR optimization.

Developers must be aware that this variable affects the performance and quality of screen space reflections. Enabling tiled optimization (by setting the value to 1) may improve performance but could potentially impact the visual quality of reflections.

Best practices when using this variable include:

  1. Testing the impact on both performance and visual quality when enabling tiled optimization.
  2. Considering the target hardware capabilities when deciding whether to enable this optimization.
  3. Using this in conjunction with the OverrideMaxRoughness setting to fine-tune the balance between performance and quality.

Regarding the associated variable CVarSSRTiledComposite:

The purpose of CVarSSRTiledComposite is to serve as the actual console variable that controls the r.SSR.TiledComposite setting. It’s defined as a TAutoConsoleVariable, which allows it to be modified at runtime.

This variable is used in the Renderer module, specifically in the screen space reflection rendering code.

The value of CVarSSRTiledComposite is set when the engine initializes, but can be changed at runtime through console commands or configuration files.

It interacts directly with the IsDefaultSSRTileEnabled function and is used in conditional statements to determine whether to apply the tiled optimization.

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 CVarSSRTiledComposite include:

  1. Using GetValueOnRenderThread() when accessing its value in render thread code.
  2. Considering performance implications when changing this value dynamically during gameplay.
  3. Documenting any project-specific default values or runtime modifications for easier maintenance and debugging.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:5

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSSRTiledComposite(
	TEXT("r.SSR.TiledComposite"), 0,
	TEXT("Enable tiled optimization of the screen space reflection."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSSRTiledCompositeOverrideMaxRoughness(
	TEXT("r.SSR.TiledComposite.OverrideMaxRoughness"), -1.0f,
	TEXT("Ignore pixels with roughness larger than this value.")

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:4

Scope: file

Source code excerpt:

#include "SceneRendering.h"

static TAutoConsoleVariable<int32> CVarSSRTiledComposite(
	TEXT("r.SSR.TiledComposite"), 0,
	TEXT("Enable tiled optimization of the screen space reflection."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSSRTiledCompositeOverrideMaxRoughness(
	TEXT("r.SSR.TiledComposite.OverrideMaxRoughness"), -1.0f,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:132

Scope (from outer to inner):

file
function     bool IsDefaultSSRTileEnabled

Source code excerpt:

bool IsDefaultSSRTileEnabled(const FViewInfo& View)
{
	return UseSSRIndirectDraw(View.GetShaderPlatform()) && CVarSSRTiledComposite.GetValueOnRenderThread();
}
/**
 * Build lists of 8x8 tiles used by SSR pixels
 * Mark and build list steps are separated in order to build a more coherent list (z-ordered over a larger region), which is important for the performance of future passes like ray traced Lumen reflections
 */
FScreenSpaceReflectionTileClassification ClassifySSRTiles(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FSceneTextures& SceneTextures, const FRDGTextureRef& DepthPrepassTexture)
{
	FScreenSpaceReflectionTileClassification Result;
	const bool bRunTiled = UseSSRIndirectDraw(View.GetShaderPlatform()) && CVarSSRTiledComposite.GetValueOnRenderThread();
	if (bRunTiled)
	{
		FIntPoint ViewRes(View.ViewRect.Width(), View.ViewRect.Height());
		Result.TiledViewRes = FIntPoint::DivideAndRoundUp(ViewRes, SSR_TILE_SIZE_XY);

		Result.TiledReflection.DrawIndirectParametersBuffer = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateIndirectDesc<FRHIDrawIndirectParameters>(), TEXT("SSR.IndirectDrawParameters"));