r.SSS.Burley.EnableProfileIdCache

r.SSS.Burley.EnableProfileIdCache

#Overview

name: r.SSS.Burley.EnableProfileIdCache

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.Burley.EnableProfileIdCache is to enable or disable a profile ID cache used in the subsurface scattering (SSS) rendering process, specifically for the Burley SSS method. This setting is part of Unreal Engine’s rendering system, focusing on optimizing the performance of subsurface scattering effects.

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

The value of this variable is set through a console variable (CVarSSSBurleyEnableProfileIdCache) with a default value of 1 (enabled). It can be changed at runtime through console commands or programmatically.

The associated variable CVarSSSBurleyEnableProfileIdCache directly interacts with r.SSS.Burley.EnableProfileIdCache. They share the same value and purpose.

Developers must be aware that enabling this cache (which is the default behavior) consumes an additional 1 byte per pixel of memory. However, it significantly improves the performance of the Burley subsurface scattering pass.

Best practices when using this variable include:

  1. Keeping it enabled (default value of 1) for better performance in most scenarios.
  2. Consider disabling it (setting to 0) only if memory constraints are a critical issue and the performance hit is acceptable.
  3. Profiling the application with and without the cache to determine the optimal setting for specific use cases.

Regarding the associated variable CVarSSSBurleyEnableProfileIdCache:

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<int32> CVarSSSBurleyEnableProfileIdCache(
		TEXT("r.SSS.Burley.EnableProfileIdCache"),
		1,
		TEXT("0: Disable profile id cache using in the sampling pass.\n")
		TEXT("1: Consumes 1 byte per pixel more memory to make Burley pass much faster. (default)\n"),
		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarSSSBurleyBilateralFilterKernelFunctionType(

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

Scope (from outer to inner):

file
function     void AddSubsurfaceViewPass

Source code excerpt:

		if (bUseProfileIdCache)
		{
			// This path was designed to get used when r.SSS.Burley.EnableProfileIdCache is true. 
			ProfileIdTexture = GraphBuilder.CreateTexture(ProfileIdTextureDescriptor, TEXT("Subsurface.ProfileIdTexture"));
		}
		else
		{
			ProfileIdTexture = SystemTextures.Black;
		}

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarSSSBurleyEnableProfileIdCache(
		TEXT("r.SSS.Burley.EnableProfileIdCache"),
		1,
		TEXT("0: Disable profile id cache using in the sampling pass.\n")
		TEXT("1: Consumes 1 byte per pixel more memory to make Burley pass much faster. (default)\n"),
		ECVF_RenderThreadSafe);

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

Scope (from outer to inner):

file
function     bool IsProfileIdCacheEnabled

Source code excerpt:

{
	return UE::PixelFormat::HasCapabilities(PF_R8_UINT, EPixelFormatCapabilities::TypedUAVLoad)
		&& CVarSSSBurleyEnableProfileIdCache.GetValueOnRenderThread() != 0;
}

uint32 GetSubsurfaceRequiredViewMask(TArrayView<const FViewInfo> Views)
{
	const uint32 ViewCount = Views.Num();
	uint32 ViewMask = 0;