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).
- type:
Var
- help:
Affects the Screen space Separable subsurface scattering pass (use shadingmodel SubsurfaceProfile, get near to the object as the default)\nis human skin which only scatters about 1.2cm)\n 0: off (if there is no object on the screen using this pass it should automatically disable the post process pass)\n<1: scale scatter radius down (for testing)\n 1: use given radius form the Subsurface scattering asset (default)\n>1: scale scatter radius up (for testing)
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:
- Setting the value to 0 effectively turns off the subsurface scattering effect.
- Values less than 1 will scale down the scatter radius, which can be useful for testing or fine-tuning the effect.
- The default value (1.0) is calibrated for human skin, which scatters light about 1.2cm.
- This variable affects performance, as subsurface scattering is a computationally expensive effect.
Best practices for using this variable include:
- Only enable subsurface scattering when necessary, as it can impact performance.
- Fine-tune the scale for different materials to achieve the most realistic results.
- Consider disabling or reducing the effect on lower-end hardware for better performance.
- Use in conjunction with other subsurface scattering parameters for best results.
Regarding the associated variable CVarSSSScale:
- It’s purpose is to provide a programmatic interface to the r.SSS.Scale console variable.
- It’s used within the Renderer module to check if subsurface scattering is enabled and to retrieve the current scale value.
- The value is set through the console variable system, just like r.SSS.Scale.
- It interacts directly with r.SSS.Scale, sharing the same value.
- Developers should be aware that changes to CVarSSSScale will affect r.SSS.Scale and vice versa.
- Best practices include using CVarSSSScale for programmatic access to the subsurface scattering scale, while using r.SSS.Scale for console-based adjustments during development or debugging.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:908, section: [Android_Vulkan_SM5 DeviceProfile]
- INI Section:
Android_Vulkan_SM5 DeviceProfile
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:619, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:646, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
0.75
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:673, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:700, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:728, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
1
- Is Array:
False
#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());