r.SSS.Filter

r.SSS.Filter

#Overview

name: r.SSS.Filter

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.SSS.Filter is to define the filter method for the Screenspace Subsurface Scattering (SSS) feature in Unreal Engine’s rendering system. This setting variable is part of the post-processing subsystem, specifically for the subsurface scattering effect.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the post-processing component responsible for subsurface scattering. This can be seen from the file location where the variable is defined: “Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessSubsurface.cpp”.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 1, which corresponds to the bilinear filter method.

This variable interacts directly with its associated variable CVarSSSFilter. They share the same value, and CVarSSSFilter is used to actually retrieve the value in the rendering code.

Developers must be aware that this variable affects the quality and performance of the subsurface scattering effect. Setting it to 0 uses a point filter, which can be useful for testing and might produce cleaner results, while setting it to 1 (the default) uses a bilinear filter, which is likely to provide better quality at a slightly higher performance cost.

Best practices when using this variable include:

  1. Keeping it at the default value (1) for most production scenarios.
  2. Using the point filter (0) only when necessary for testing or if the performance impact of the bilinear filter is too high.
  3. Being aware that changing this value at runtime may affect the visual consistency of the game.

Regarding the associated variable CVarSSSFilter:

The purpose of CVarSSSFilter is to provide a programmatic way to access and modify the r.SSS.Filter setting within the C++ code of the engine.

This variable is used directly in the rendering code, specifically in the GetSSSFilter() function, which retrieves the current value of the setting on the render thread.

The value of CVarSSSFilter is set automatically by the console variable system when r.SSS.Filter is modified.

CVarSSSFilter interacts directly with r.SSS.Filter, effectively serving as its in-code representation.

Developers should be aware that CVarSSSFilter should be accessed using the GetValueOnRenderThread() method when used in rendering code to ensure thread safety.

Best practices for using CVarSSSFilter include:

  1. Always accessing it through the GetSSSFilter() function rather than directly, as this function ensures the value is retrieved on the render thread.
  2. Avoiding frequent changes to this value during gameplay, as it may impact performance and visual consistency.
  3. Using it in conjunction with other subsurface scattering settings for fine-tuning the SSS effect in different scenarios or on different hardware.

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<int32> CVarSSSFilter(
		TEXT("r.SSS.Filter"),
		1,
		TEXT("Defines the filter method for Screenspace Subsurface Scattering feature.\n")
		TEXT(" 0: point filter (useful for testing, could be cleaner)\n")
		TEXT(" 1: bilinear filter"),
		ECVF_RenderThreadSafe | ECVF_Scalability);

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

		ECVF_RenderThreadSafe | ECVF_Scalability);

	TAutoConsoleVariable<int32> CVarSSSFilter(
		TEXT("r.SSS.Filter"),
		1,
		TEXT("Defines the filter method for Screenspace Subsurface Scattering feature.\n")
		TEXT(" 0: point filter (useful for testing, could be cleaner)\n")
		TEXT(" 1: bilinear filter"),
		ECVF_RenderThreadSafe | ECVF_Scalability);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessSubsurface.cpp:189

Scope (from outer to inner):

file
function     int32 GetSSSFilter

Source code excerpt:

int32 GetSSSFilter()
{
	return CVarSSSFilter.GetValueOnRenderThread();
}

int32 GetSSSSampleSet()
{
	return CVarSSSSampleSet.GetValueOnRenderThread();
}