r.ClearCoatNormal
r.ClearCoatNormal
#Overview
name: r.ClearCoatNormal
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 to disable clear coat normal.\n 0: off\n 1: on
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ClearCoatNormal is to control the usage of clear coat normal in the rendering system. It is a console variable that enables or disables the clear coat normal feature in Unreal Engine 5’s rendering pipeline.
This setting variable is primarily used by the rendering subsystem of Unreal Engine 5. Specifically, it affects shader compilation and material rendering. The following modules rely on this variable:
- Renderer module (DeferredShadingRenderer.cpp)
- Engine module (ShaderCompiler.cpp and ShaderGenerationUtil.cpp)
- RenderCore module (Shader.cpp)
The value of this variable is set through the console command system. It is defined as a TAutoConsoleVariable with a default value of 0 (disabled). Users can change this value at runtime using console commands.
This variable interacts with other rendering-related variables, particularly those affecting shader compilation and material properties. It is often used in conjunction with platform-specific checks (e.g., !bIsMobilePlatform) to determine whether to enable the clear coat bottom normal feature.
Developers must be aware that:
- This variable is marked as ECVF_ReadOnly, meaning it should not be modified during runtime after initial setup.
- It affects shader compilation, so changing its value may require recompilation of shaders.
- The feature is not available on mobile platforms, even if the variable is set to 1.
Best practices when using this variable include:
- Set it early in the application lifecycle to ensure consistent behavior.
- Consider performance implications when enabling the clear coat normal feature, especially on lower-end hardware.
- Test thoroughly on all target platforms to ensure the desired visual quality and performance.
- Use in conjunction with other related rendering features for optimal results.
- Document any project-specific usage or requirements related to this variable for other team members.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:111, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
True
- 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/DeferredShadingRenderer.cpp:112
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarClearCoatNormal(
TEXT("r.ClearCoatNormal"),
0,
TEXT("0 to disable clear coat normal.\n")
TEXT(" 0: off\n")
TEXT(" 1: on"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8307
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ClearCoatNormal"));
SET_SHADER_DEFINE(Input.Environment, CLEAR_COAT_BOTTOM_NORMAL, CVar ? (CVar->GetValueOnAnyThread() != 0) && !bIsMobilePlatform : 0);
}
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
SET_SHADER_DEFINE(Input.Environment, IRIS_NORMAL, CVar ? (CVar->GetValueOnAnyThread() != 0) : 0);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderGenerationUtil.cpp:328
Scope (from outer to inner):
file
function static FShaderGlobalDefines FetchShaderGlobalDefines
Source code excerpt:
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ClearCoatNormal"));
Ret.CLEAR_COAT_BOTTOM_NORMAL = CVar ? (CVar->GetValueOnAnyThread() != 0) && !bIsMobilePlatform : 0;
}
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
Ret.IRIS_NORMAL = CVar ? (CVar->GetValueOnAnyThread() != 0) : 0;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1528
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ClearCoatNormal"));
KeyString += (CVar && CVar->GetValueOnAnyThread() != 0) ? TEXT("_CCBN") : TEXT("_NoCCBN");
}
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
KeyString += (CVar && CVar->GetValueOnAnyThread() != 0) ? TEXT("_Iris") : TEXT("_NoIris");