r.SSS.Checkerboard.NeighborSSSValidation
r.SSS.Checkerboard.NeighborSSSValidation
#Overview
name: r.SSS.Checkerboard.NeighborSSSValidation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable or disable checkerboard neighbor subsurface scattering validation.\nThis validation can remove border light leakage into subsurface scattering, creating a sharpe border with correct color 0: Disabled (default) 1: Enabled. Add 1 subsurface profile id query/pixel (low quality), 4 id query/pixel (high quality) at recombine pass
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SSS.Checkerboard.NeighborSSSValidation is to control the validation of checkerboard neighbor subsurface scattering in the rendering system. This setting is specifically related to the subsurface scattering (SSS) rendering technique.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the post-processing subsystem for subsurface scattering effects.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0 (disabled) and can be changed at runtime.
The associated variable CVarSSSCheckerboardNeighborSSSValidation directly interacts with r.SSS.Checkerboard.NeighborSSSValidation. They share the same value and purpose.
Developers must be aware that enabling this validation can impact performance. When enabled, it adds additional subsurface profile ID queries per pixel during the recombine pass of the SSS effect. This can be either 1 query per pixel for low quality or 4 queries per pixel for high quality.
Best practices when using this variable include:
- Keep it disabled (0) by default for optimal performance.
- Enable it (1) when you notice light leakage at the borders of subsurface scattering effects and need sharper, color-correct borders.
- Be mindful of the performance impact, especially in performance-critical scenarios or on lower-end hardware.
Regarding the associated variable CVarSSSCheckerboardNeighborSSSValidation:
The purpose of CVarSSSCheckerboardNeighborSSSValidation is the same as r.SSS.Checkerboard.NeighborSSSValidation. It’s the actual console variable that controls the checkerboard neighbor subsurface scattering validation.
This variable is used in the Renderer module, specifically in the SubsurfaceRecombinePS class, which is part of the post-processing pipeline for subsurface scattering.
The value of this variable is set through the console variable system and can be accessed on the render thread using GetValueOnRenderThread().
It directly interacts with the r.SSS.Checkerboard.NeighborSSSValidation setting, as they represent the same functionality.
Developers should be aware that this variable’s value is checked on the render thread, which means changes to it will affect rendering in real-time.
Best practices for using this variable include:
- Use it in conjunction with checkerboard rendering for subsurface scattering.
- Consider the performance implications when enabling it, especially in performance-critical scenarios.
- Use it as a toggle for the validation feature, enabling it only when necessary to address specific visual artifacts.
#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:97
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarSSSCheckerboardNeighborSSSValidation(
TEXT("r.SSS.Checkerboard.NeighborSSSValidation"),
0,
TEXT("Enable or disable checkerboard neighbor subsurface scattering validation.\n")
TEXT("This validation can remove border light leakage into subsurface scattering, creating a sharpe border with correct color")
TEXT(" 0: Disabled (default)")
TEXT(" 1: Enabled. Add 1 subsurface profile id query/pixel (low quality), 4 id query/pixel (high quality) at recombine pass"),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSSCheckerboardNeighborSSSValidation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessSubsurface.cpp:96
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarSSSCheckerboardNeighborSSSValidation(
TEXT("r.SSS.Checkerboard.NeighborSSSValidation"),
0,
TEXT("Enable or disable checkerboard neighbor subsurface scattering validation.\n")
TEXT("This validation can remove border light leakage into subsurface scattering, creating a sharpe border with correct color")
TEXT(" 0: Disabled (default)")
TEXT(" 1: Enabled. Add 1 subsurface profile id query/pixel (low quality), 4 id query/pixel (high quality) at recombine pass"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessSubsurface.cpp:915
Scope (from outer to inner):
file
class class FSubsurfaceRecombinePS : public FSubsurfaceShader
function static uint32 GetCheckerBoardNeighborSSSValidation
Source code excerpt:
static uint32 GetCheckerBoardNeighborSSSValidation(bool bCheckerBoard)
{
bool bValidation = CVarSSSCheckerboardNeighborSSSValidation.GetValueOnRenderThread() > 0 ? true : false;
return (bCheckerBoard && bValidation) ? 1u : 0u;
}
};
IMPLEMENT_GLOBAL_SHADER(FSubsurfaceRecombinePS, "/Engine/Private/PostProcessSubsurface.usf", "SubsurfaceRecombinePS", SF_Pixel);