r.Mobile.DisableVertexFog

r.Mobile.DisableVertexFog

#Overview

name: r.Mobile.DisableVertexFog

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).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Mobile.DisableVertexFog is to control the use of vertex fog in mobile rendering. Here’s a detailed explanation:

  1. Purpose: This variable is used to disable vertex fog in mobile rendering pipelines. When set to 1 (default), it disables vertex fog, and when set to 0, it enables vertex fog.

  2. Subsystems/Modules: This setting primarily affects the mobile rendering system, particularly the fog rendering and base pass rendering modules.

  3. Value Setting: The value is set through the console variable system, likely configurable in the project settings or through console commands.

  4. Interaction: This variable interacts with other fog-related settings and the mobile rendering pipeline. When disabled, it may trigger the use of pixel-based fog techniques instead.

  5. Developer Awareness:

    • Disabling vertex fog may impact performance on mobile devices, as pixel-based fog can be more expensive.
    • This setting affects shader compilation, potentially increasing shader permutations.
    • Changes to this variable require shader recompilation for the changes to take effect.
  6. Best Practices:

    • Only disable vertex fog if there are visual quality issues that can’t be resolved otherwise.
    • Consider the performance implications on target mobile devices before changing this setting.
    • Test thoroughly on various mobile devices to ensure acceptable performance and visual quality when modifying this setting.
    • Be aware that changing this setting will trigger shader recompilation, which can impact development and build times.

Developers should carefully consider the trade-offs between performance and visual quality when adjusting this setting, especially for mobile platforms where performance is often a critical concern.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:133, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileBasePassRendering.cpp:25

Scope: file

Source code excerpt:

// Changing this causes a full shader recompile
static TAutoConsoleVariable<int32> CVarMobileDisableVertexFog(
	TEXT("r.Mobile.DisableVertexFog"),
	1,
	TEXT("If true, vertex fog will be omitted from the most of the mobile base pass shaders. Instead, fog will be applied in a separate pass and only when scene has a fog component."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarMobileEnableMovableSpotLightShadows(
	TEXT("r.Mobile.EnableMovableSpotlightsShadow"),

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

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DisableVertexFog"));
		SET_SHADER_DEFINE(Input.Environment, PROJECT_MOBILE_DISABLE_VERTEX_FOG, CVar ? (CVar->GetInt() != 0) : 0);
	}

	bool bSupportLocalFogVolumes = false;
	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportLocalFogVolumes"));

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

Scope (from outer to inner):

file
function     static FShaderGlobalDefines FetchShaderGlobalDefines

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DisableVertexFog"));
		Ret.PROJECT_MOBILE_DISABLE_VERTEX_FOG = CVar ? (CVar->GetInt() != 0) : 0;
	}

	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.AllowGlobalClipPlane"));
		Ret.PROJECT_ALLOW_GLOBAL_CLIP_PLANE = CVar ? (CVar->GetInt() != 0) : 0;

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

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:

	{
		{
			static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DisableVertexFog"));
			KeyString += (CVar && CVar->GetInt() != 0) ? TEXT("_NoVFog") : TEXT("");
		}
		
		{
			static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.FloatPrecisionMode"));
			if(CVar && CVar->GetInt() > 0)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileFogRendering.cpp:140

Scope (from outer to inner):

file
function     void FMobileSceneRenderer::RenderFog

Source code excerpt:

	};

	static const auto* CVarDisableVertexFog = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.DisableVertexFog"));
	if (CVarDisableVertexFog && CVarDisableVertexFog->GetValueOnRenderThread() == 0)
	{
		// Project uses only vertex fogging
		return;
	}