r.HLOD.DitherPauseTime

r.HLOD.DitherPauseTime

#Overview

name: r.HLOD.DitherPauseTime

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.HLOD.DitherPauseTime is to control the duration of the pause in the dithering transition for Hierarchical Level of Detail (HLOD) actors in Unreal Engine 5. This setting is primarily used in the rendering system, specifically for managing the visibility and transitions of HLOD actors.

This setting variable is utilized by the Engine module, particularly within the LODActor class and its related functionalities. The HLOD system is part of Unreal Engine’s optimization techniques for rendering large, complex scenes efficiently.

The value of this variable is set as a console variable with a default value of 0.5 seconds. It can be modified at runtime through the console or programmatically.

The associated variable CVarHLODDitherPauseTime directly interacts with r.HLOD.DitherPauseTime, as they share the same value. This console variable is used in the implementation of the dithering transition logic.

Developers should be aware that this variable affects the visual transition of HLOD actors. A longer pause time may result in a more noticeable pop-in effect, while a shorter time might create a smoother but potentially more resource-intensive transition.

Best practices when using this variable include:

  1. Adjusting the value based on the specific needs of the scene and target hardware capabilities.
  2. Testing different values to find the optimal balance between visual quality and performance.
  3. Considering the impact on different platforms, especially those with varying rendering capabilities.

Regarding the associated variable CVarHLODDitherPauseTime:

The purpose of CVarHLODDitherPauseTime is to provide a programmatic interface to access and modify the r.HLOD.DitherPauseTime value within the engine’s C++ code.

This variable is used in the Engine module, specifically within the LODActor class implementation. It’s primarily utilized in the Tick function of the ALODActor class to control the timing of draw distance resets.

The value of CVarHLODDitherPauseTime is set when the console variable r.HLOD.DitherPauseTime is initialized. It can be accessed using the GetValueOnAnyThread() method.

This variable directly interacts with the ResetDrawDistanceTime member of the ALODActor class to determine when to reset the draw distance of HLOD components.

Developers should be aware that modifying CVarHLODDitherPauseTime will affect the behavior of all HLOD actors in the scene. It’s crucial to consider the performance implications of changes to this value.

Best practices for using CVarHLODDitherPauseTime include:

  1. Using it in conjunction with profiling tools to optimize HLOD transitions.
  2. Considering its impact on different hardware configurations when fine-tuning performance.
  3. Documenting any custom modifications to this value for easier maintenance and debugging.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:47

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarHLODDitherPauseTime(
	TEXT("r.HLOD.DitherPauseTime"),
	0.5f,
	TEXT("HLOD dither pause time in seconds\n"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

ENGINE_API TAutoConsoleVariable<FString> CVarHLODDistanceOverride(
	TEXT("r.HLOD.DistanceOverride"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/LODActor.h:121

Scope (from outer to inner):

file
class        class ALODActor : public AActor

Source code excerpt:

	/** Forces the mesh into view by setting the MinDrawDistance to zero (this pops the mesh into view, no fading)*/
	ENGINE_API void PauseDitherTransition();
	/** Makes the actor tickable and according to r.HLOD.DitherPauseTime sets the MinDrawDistance back to non-zero */
	ENGINE_API void StartDitherTransition();

	/** Sets StaticMesh and IsPreviewActor to true if InStaticMesh equals nullptr */
	ENGINE_API void SetStaticMesh(UStaticMesh* InStaticMesh);

	/** Add instances to this LODActor. */

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:46

Scope: file

Source code excerpt:

	ECVF_Scalability);

static TAutoConsoleVariable<float> CVarHLODDitherPauseTime(
	TEXT("r.HLOD.DitherPauseTime"),
	0.5f,
	TEXT("HLOD dither pause time in seconds\n"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

ENGINE_API TAutoConsoleVariable<FString> CVarHLODDistanceOverride(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:440

Scope (from outer to inner):

file
function     void ALODActor::Tick

Source code excerpt:

	if (bNeedsDrawDistanceReset)
	{		
		if (ResetDrawDistanceTime > CVarHLODDitherPauseTime.GetValueOnAnyThread())
		{
			// Determine desired HLOD state
			float MinDrawDistance = GetLODDrawDistanceWithOverride();

			SetComponentsMinDrawDistance(MinDrawDistance, true);
			bNeedsDrawDistanceReset = false;