r.Substrate.SpecularProfile

r.Substrate.SpecularProfile

#Overview

name: r.Substrate.SpecularProfile

The value of this variable can be defined or overridden in .ini config files. 2 .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.Substrate.SpecularProfile is to enable or disable Specular Profile support for Substrate slabs in Unreal Engine’s rendering system.

This setting variable is primarily used in the rendering subsystem of Unreal Engine, specifically within the Substrate namespace, which is likely a part of the engine’s material rendering pipeline.

The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with a default value of 1, meaning it’s enabled by default.

The associated variable CVarSubstrateSpecularProfile interacts directly with r.Substrate.SpecularProfile. They share the same value and are used interchangeably in different contexts.

Developers must be aware of several important aspects when using this variable:

  1. Changing this variable requires shader recompilation, as indicated in the comment.
  2. It is marked as ECVF_ReadOnly and ECVF_RenderThreadSafe, meaning it should not be modified during runtime and is safe to access from the render thread.
  3. The variable is used in conjunction with the IsSubstrateEnabled() function, suggesting that Substrate must be enabled for this setting to have an effect.

Best practices when using this variable include:

  1. Only modify it when necessary, as it requires shader recompilation.
  2. Ensure that Substrate is enabled when relying on this feature.
  3. Be cautious when accessing or modifying this variable, respecting its read-only and render thread safe nature.

Regarding the associated variable CVarSubstrateSpecularProfile:

The purpose of CVarSubstrateSpecularProfile is to provide a runtime-accessible version of the r.Substrate.SpecularProfile setting.

It is used in the same rendering subsystem and Substrate namespace as r.Substrate.SpecularProfile.

Its value is set when the TAutoConsoleVariable is initialized, mirroring the value of r.Substrate.SpecularProfile.

CVarSubstrateSpecularProfile interacts directly with the IsSpecularProfileEnabled() function, which checks if both Substrate is enabled and this variable’s value is greater than 0.

Developers should be aware that this variable is accessed using the GetValueOnAnyThread() method, indicating it’s designed for multi-threaded access.

Best practices for using CVarSubstrateSpecularProfile include:

  1. Use it for runtime checks of the Specular Profile feature’s status.
  2. Remember that changing its value at runtime may not have an immediate effect due to the shader recompilation requirement.
  3. Always use it in conjunction with IsSubstrateEnabled() checks to ensure correct behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:101, section: [/Script/Engine.RendererSettings]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:19, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1819

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSubstrateSpecularProfile(
	TEXT("r.Substrate.SpecularProfile"),
	1,
	TEXT("Enable Specular Profile support for Substrate slabs. If changed, shaders needs to be recompiled."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateDebugAdvancedVisualizationShaders(
	TEXT("r.Substrate.Debug.AdvancedVisualizationShaders"),

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1958

Scope (from outer to inner):

file
namespace    Substrate
function     bool IsSpecularProfileEnabled

Source code excerpt:

	bool IsSpecularProfileEnabled(EShaderPlatform InPlatform)
	{
		static FShaderPlatformCachedIniValue<int32> CVar(TEXT("r.Substrate.SpecularProfile"));
		return IsSubstrateEnabled() && CVar.Get(InPlatform) > 0;
	}

	uint32 GetSheenQuality()
	{
		return CVarSubstrateSheenQuality.GetValueOnAnyThread();

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1818

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateSpecularProfile(
	TEXT("r.Substrate.SpecularProfile"),
	1,
	TEXT("Enable Specular Profile support for Substrate slabs. If changed, shaders needs to be recompiled."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateDebugAdvancedVisualizationShaders(

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1953

Scope (from outer to inner):

file
namespace    Substrate
function     bool IsSpecularProfileEnabled

Source code excerpt:

	bool IsSpecularProfileEnabled()
	{
		return IsSubstrateEnabled() && CVarSubstrateSpecularProfile.GetValueOnAnyThread() > 0;
	}

	bool IsSpecularProfileEnabled(EShaderPlatform InPlatform)
	{
		static FShaderPlatformCachedIniValue<int32> CVar(TEXT("r.Substrate.SpecularProfile"));
		return IsSubstrateEnabled() && CVar.Get(InPlatform) > 0;