r.SSS.Scale

r.SSS.Scale

#Overview

name: r.SSS.Scale

The value of this variable can be defined or overridden in .ini config files. 6 .ini config files referencing this setting variable.

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.SSS.Scale is to control the scale of the Screen Space Separable (SSS) subsurface scattering effect in Unreal Engine’s rendering system. It affects the radius of the scattering effect, which is particularly important for rendering realistic human skin and other translucent materials.

This setting variable is primarily used by the rendering subsystem of Unreal Engine, specifically within the post-processing pipeline for subsurface scattering effects. It’s referenced in the PostProcessSubsurface.cpp file, which is part of the Renderer module.

The value of this variable is set through the console variable system. It’s initialized with a default value of 1.0f, but can be changed at runtime using console commands or through code.

The r.SSS.Scale variable interacts closely with its associated variable CVarSSSScale. They share the same value and are used interchangeably in the code. The CVarSSSScale is used to check if subsurface scattering is enabled and to retrieve the current scale value.

Developers should be aware of several key points when using this variable:

  1. Setting the value to 0 effectively turns off the subsurface scattering effect.
  2. Values less than 1 will scale down the scatter radius, which can be useful for testing or fine-tuning the effect.
  3. The default value (1.0) is calibrated for human skin, which scatters light about 1.2cm.
  4. This variable affects performance, as subsurface scattering is a computationally expensive effect.

Best practices for using this variable include:

  1. Only enable subsurface scattering when necessary, as it can impact performance.
  2. Fine-tune the scale for different materials to achieve the most realistic results.
  3. Consider disabling or reducing the effect on lower-end hardware for better performance.
  4. Use in conjunction with other subsurface scattering parameters for best results.

Regarding the associated variable CVarSSSScale:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:908, section: [Android_Vulkan_SM5 DeviceProfile]

Location: <Workspace>/Engine/Config/BaseScalability.ini:619, section: [EffectsQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:646, section: [EffectsQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:673, section: [EffectsQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:700, section: [EffectsQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:728, section: [EffectsQuality@Cine]

#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:34

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<float> CVarSSSScale(
		TEXT("r.SSS.Scale"),
		1.0f,
		TEXT("Affects the Screen space Separable subsurface scattering pass ")
		TEXT("(use shadingmodel SubsurfaceProfile, get near to the object as the default)\n")
		TEXT("is human skin which only scatters about 1.2cm)\n")
		TEXT(" 0: off (if there is no object on the screen using this pass it should automatically disable the post process pass)\n")
		TEXT("<1: scale scatter radius down (for testing)\n")

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

Scope: file

Source code excerpt:



// Returns the [0, N] clamped value of the 'r.SSS.Scale' CVar.
float GetSubsurfaceRadiusScale()
{
	static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.SSS.Scale"));
	check(CVar);

	return FMath::Max(0.0f, CVar->GetValueOnRenderThread());
}

int32 GetSSSFilter()

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

		ECVF_RenderThreadSafe | ECVF_Scalability);

	TAutoConsoleVariable<float> CVarSSSScale(
		TEXT("r.SSS.Scale"),
		1.0f,
		TEXT("Affects the Screen space Separable subsurface scattering pass ")
		TEXT("(use shadingmodel SubsurfaceProfile, get near to the object as the default)\n")
		TEXT("is human skin which only scatters about 1.2cm)\n")
		TEXT(" 0: off (if there is no object on the screen using this pass it should automatically disable the post process pass)\n")

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

Scope (from outer to inner):

file
function     bool IsSubsurfaceEnabled

Source code excerpt:

{
	const bool bEnabled = CVarSubsurfaceScattering.GetValueOnAnyThread() != 0;
	const bool bHasScale = CVarSSSScale.GetValueOnAnyThread() > 0.0f;
	return (bEnabled && bHasScale);
}

bool IsSubsurfaceRequiredForView(const FViewInfo& View)
{
	const bool bSimpleDynamicLighting = IsForwardShadingEnabled(View.GetShaderPlatform());