r.SSS.Burley.MinGenerateMipsTileCount

r.SSS.Burley.MinGenerateMipsTileCount

#Overview

name: r.SSS.Burley.MinGenerateMipsTileCount

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.MinGenerateMipsTileCount is to control the generation of mip maps for subsurface scattering (SSS) radiance in Unreal Engine’s rendering system. Specifically, it sets a threshold for the number of tiles that must be present before the engine generates mip maps for the SSS radiance texture.

This setting variable is primarily used in the rendering subsystem of Unreal Engine, particularly in the post-processing stage for subsurface scattering effects. It’s part of the Burley SSS implementation, which is an advanced technique for rendering realistic skin and other translucent materials.

The value of this variable is set through a console variable (CVar) system. It’s defined with a default value of 4000 tiles, but can be changed at runtime through console commands or programmatically.

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

Developers should be aware that:

  1. Setting this value to zero will always generate mips, which might impact performance.
  2. The value is used as a threshold, so higher values will result in less frequent mip generation.
  3. This is an experimental value, so its behavior might change in future engine versions.

Best practices when using this variable include:

  1. Only modify it if you’re experiencing specific issues with SSS rendering quality or performance.
  2. Monitor performance when adjusting this value, as it can affect rendering time.
  3. Test thoroughly across different hardware configurations, as the optimal value may vary.

Regarding the associated variable CVarSSSMipmapsMinTileCount:

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<int32> CVarSSSMipmapsMinTileCount(
		TEXT("r.SSS.Burley.MinGenerateMipsTileCount"),
		4000,
		TEXT("4000. (default) The minimal number of tiles to trigger subsurface radiance mip generation. Set to zero to always generate mips (Experimental value)"),
		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<float> CVarSubSurfaceColorAsTannsmittanceAtDistance(
		TEXT("r.SSS.SubSurfaceColorAsTansmittanceAtDistance"),

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarSSSMipmapsMinTileCount(
		TEXT("r.SSS.Burley.MinGenerateMipsTileCount"),
		4000,
		TEXT("4000. (default) The minimal number of tiles to trigger subsurface radiance mip generation. Set to zero to always generate mips (Experimental value)"),
		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<float> CVarSubSurfaceColorAsTannsmittanceAtDistance(

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

Scope: file

Source code excerpt:


	const float SSSOverrideNumSamples = float(CVarSSSBurleyNumSamplesOverride.GetValueOnRenderThread());
	const float MinGenerateMipsTileCount = FMath::Max(0.0f, CVarSSSMipmapsMinTileCount.GetValueOnRenderThread());

	FSubsurfaceParameters Parameters;
	Parameters.SubsurfaceParams = FVector4f(SSSScaleX, SSSScaleZ, SSSOverrideNumSamples, MinGenerateMipsTileCount);
	Parameters.ViewUniformBuffer = View.ViewUniformBuffer;
	Parameters.SceneTextures = SceneTextures;
	return Parameters;

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

Scope (from outer to inner):

file
function     void AddSubsurfaceViewPass

Source code excerpt:

	const bool bUseProfileIdCache = !bForceRunningInSeparable && IsProfileIdCacheEnabled();

	const int32 MinGenerateMipsTileCount = FMath::Max(0, CVarSSSMipmapsMinTileCount.GetValueOnRenderThread());

	/**
	 * All subsurface passes within the screen-space subsurface effect can operate at half or full resolution,
	 * depending on the subsurface mode. The values are precomputed and shared among all Subsurface textures.
	 */
	const FScreenPassTextureViewport SubsurfaceViewport = GetDownscaledViewport(SceneViewport, ScaleFactor);