r.IrisNormal

r.IrisNormal

#Overview

name: r.IrisNormal

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.IrisNormal is to enable or disable the iris normal feature in Unreal Engine’s rendering system. This setting variable is used to control the inclusion of iris normal calculations in shader compilations and shader key generation.

The r.IrisNormal variable is primarily used by the rendering system and shader compilation subsystems of Unreal Engine. Specifically, it’s referenced in the Renderer, Engine, and RenderCore modules.

The value of this variable is set through a console variable (CVar) declaration in the DeferredShadingRenderer.cpp file. It’s initialized with a default value of 0 (disabled) and can be changed at runtime.

This variable interacts with shader compilation and generation processes. It’s used to set shader defines and is included in shader key strings, which affect how shaders are compiled and cached.

Developers should be aware that changing this variable may require shader recompilation, which can impact performance during development. Additionally, enabling iris normal calculations may have performance implications in the final rendered output.

Best practices when using this variable include:

  1. Only enable it when iris normal calculations are necessary for your project’s visual requirements.
  2. Be mindful of the performance impact, especially on lower-end hardware.
  3. If enabled, ensure that your art assets and materials are properly set up to take advantage of iris normal calculations.
  4. Consider exposing this setting to end-users as a graphics option if the visual difference is significant and the performance impact is manageable.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:120

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarIrisNormal(
	TEXT("r.IrisNormal"),
	0,
	TEXT("0 to disable iris normal.\n")
	TEXT(" 0: off\n")
	TEXT(" 1: on"),
	ECVF_ReadOnly);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8312

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
		SET_SHADER_DEFINE(Input.Environment, IRIS_NORMAL, CVar ? (CVar->GetValueOnAnyThread() != 0) : 0);
	}

	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("Compat.UseDXT5NormalMaps"));
		SET_SHADER_DEFINE(Input.Environment, DXT5_NORMALMAPS, CVar ? (CVar->GetValueOnAnyThread() != 0) : 0);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderGenerationUtil.cpp:333

Scope (from outer to inner):

file
function     static FShaderGlobalDefines FetchShaderGlobalDefines

Source code excerpt:


	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
		Ret.IRIS_NORMAL = CVar ? (CVar->GetValueOnAnyThread() != 0) : 0;
	}

	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("Compat.UseDXT5NormalMaps"));
		Ret.DXT5_NORMALMAPS = CVar ? (CVar->GetValueOnAnyThread() != 0) : 0;

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1533

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:


	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.IrisNormal"));
		KeyString += (CVar && CVar->GetValueOnAnyThread() != 0) ? TEXT("_Iris") : TEXT("_NoIris");
	}

	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.CompileShadersForDevelopment"));
		KeyString += (CVar && CVar->GetValueOnAnyThread() != 0) ? TEXT("_DEV") : TEXT("_NoDEV");