r.TSR.ShadingRejection.TileOverscan

r.TSR.ShadingRejection.TileOverscan

#Overview

name: r.TSR.ShadingRejection.TileOverscan

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.TSR.ShadingRejection.TileOverscan is to control the tile overscan in the Temporal Super Resolution (TSR) shading rejection process. This setting is part of the rendering system, specifically the post-processing pipeline for temporal upscaling.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly in the Temporal Super Resolution subsystem. It’s referenced in the TemporalSuperResolution.cpp file, which handles the implementation of TSR.

The value of this variable is set through a console variable (CVarTSRShadingTileOverscan) with a default value of 3. It can be modified at runtime through console commands or project settings.

The associated variable CVarTSRShadingTileOverscan interacts directly with r.TSR.ShadingRejection.TileOverscan, as they share the same value and purpose.

Developers must be aware that this variable affects the performance and quality trade-off in the TSR process. A higher value reduces tiling artifacts but may impact performance. The variable is used to determine the overlap of tiles in the shading rejection process, which involves a network of convolutions on the GPU.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project, balancing between artifact reduction and performance.
  2. Testing different values to find the optimal setting for your scene.
  3. Being cautious when setting very high values, as it may significantly impact performance.
  4. Considering the relationship between this setting and other TSR-related variables for optimal results.

Regarding the associated variable CVarTSRShadingTileOverscan:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:183

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarTSRShadingTileOverscan(
	TEXT("r.TSR.ShadingRejection.TileOverscan"), 3,
	TEXT("The shading rejection run a network of convolutions on the GPU all in single 32x32 without roundtrip to main video memory. ")
	TEXT("However chaining many convlutions in this tiles means that some convolutions on the edge arround are becoming corrupted ")
	TEXT("and therefor need to overlap the tile by couple of padding to hide it. Higher means less prones to tiling artifacts, but performance loss."),
	ECVF_RenderThreadSafe);

TAutoConsoleVariable<float> CVarTSRShadingExposureOffset(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:182

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarTSRShadingTileOverscan(
	TEXT("r.TSR.ShadingRejection.TileOverscan"), 3,
	TEXT("The shading rejection run a network of convolutions on the GPU all in single 32x32 without roundtrip to main video memory. ")
	TEXT("However chaining many convlutions in this tiles means that some convolutions on the edge arround are becoming corrupted ")
	TEXT("and therefor need to overlap the tile by couple of padding to hide it. Higher means less prones to tiling artifacts, but performance loss."),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:2064

Scope (from outer to inner):

file
function     FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses

Source code excerpt:


		const int32 GroupTileSize = 32;
		const int32 TileOverscan = FMath::Clamp(CVarTSRShadingTileOverscan.GetValueOnRenderThread(), 3, GroupTileSize / 2 - 1);
		const int32 TileSize = GroupTileSize - 2 * TileOverscan;

		FTSRRejectShadingCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FTSRRejectShadingCS::FParameters>();
		PassParameters->CommonParameters = CommonParameters;
		PassParameters->InputPixelPosToTranslucencyTextureUV =
			((FScreenTransform::Identity + 0.5f - InputRect.Min) / InputRect.Size()) *