r.Mobile.AllowDitheredLODTransition

r.Mobile.AllowDitheredLODTransition

#Overview

name: r.Mobile.AllowDitheredLODTransition

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.Mobile.AllowDitheredLODTransition is to control whether the ‘Dithered LOD Transition’ material option is supported on mobile platforms in Unreal Engine 5.

This setting variable is primarily used by the rendering system, specifically for mobile platforms. It is referenced in the Engine and RenderCore modules, indicating its importance in the rendering pipeline for mobile devices.

The value of this variable is set through the console or the project settings. It can be configured in the RendererSettings class, which is part of the Engine’s configuration system.

This variable interacts with material settings and shader compilation. When enabled, it allows materials to use the ‘Dithered LOD Transition’ option on mobile platforms, which can affect performance and visual quality.

Developers must be aware that enabling this option may degrade performance on mobile devices. As mentioned in the tooltip, rendering will not benefit from Early-Z optimization when this feature is enabled.

Best practices when using this variable include:

  1. Only enable it if the ‘Dithered LOD Transition’ effect is crucial for your mobile game’s visual quality.
  2. Test thoroughly on target mobile devices to ensure performance remains acceptable when enabled.
  3. Consider using it selectively, perhaps only for specific important assets rather than globally.
  4. Be prepared to adjust LOD settings and transitions to compensate for any performance impact.
  5. Remember that changes to this setting require a restart of the engine to take effect.

Developers should carefully weigh the visual benefits against the potential performance costs when deciding to enable this feature on mobile platforms.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3545

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMobileAllowDitheredLODTransition(
	TEXT("r.Mobile.AllowDitheredLODTransition"),
	0,
	TEXT("Whether to support 'Dithered LOD Transition' material option on mobile platforms"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarMobileAllowPixelDepthOffset(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:329

Scope (from outer to inner):

file
class        class URendererSettings : public UDeveloperSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = Mobile, meta=(
		ConsoleVariable="r.Mobile.AllowDitheredLODTransition", DisplayName="Allow Dithered LOD Transition",
		ToolTip="Whether to support 'Dithered LOD Transition' material option on mobile platforms. Enabling this may degrade performance as rendering will not benefit from Early-Z optimization.",
		ConfigRestartRequired=true))
	uint32 bMobileAllowDitheredLODTransition:1;

	UPROPERTY(config, EditAnywhere, Category = Mobile, meta = (
		EditCondition = "bVirtualTextures",

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialShared.cpp:176

Scope (from outer to inner):

file
function     bool AllowDitheredLODTransition

Source code excerpt:

	if (FeatureLevel <= ERHIFeatureLevel::ES3_1)
	{
		static TConsoleVariableData<int32>* CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowDitheredLODTransition"));
		return (CVar && CVar->GetValueOnAnyThread() != 0) ? true : false;
	}
	return true;
}

FName MaterialQualityLevelNames[] = 

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

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:


		{
			static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.AllowDitheredLODTransition"));
			KeyString += (CVar && CVar->GetInt() != 0) ? TEXT("_DLODT") : TEXT("");
		}
		
		KeyString += IsUsingEmulatedUniformBuffers(Platform) ? TEXT("_NoUB") : TEXT("");

		{