lod.TemporalLag

lod.TemporalLag

#Overview

name: lod.TemporalLag

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of lod.TemporalLag is to control the time lag for temporal Level of Detail (LOD) in seconds. This setting is part of the rendering system in Unreal Engine 5, specifically related to LOD management.

This setting variable is primarily used in the Engine module, particularly in the scene management subsystem. It is referenced in the SceneManagement.cpp file, which suggests it’s an integral part of how Unreal Engine manages scene rendering and LOD transitions.

The value of this variable is set using a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands. The default value is set to 0.5 seconds.

The associated variable CVarLODTemporalLag directly interacts with lod.TemporalLag. It’s defined as a static TAutoConsoleVariable and serves as the actual storage and access point for the lod.TemporalLag value in the C++ code.

Developers must be aware that this variable affects the smoothness of LOD transitions. A higher value will result in slower, more gradual LOD changes, while a lower value will make LOD transitions quicker but potentially more noticeable.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project, considering factors like performance and visual quality.
  2. Testing different values to find the right balance between smooth transitions and responsiveness.
  3. Being mindful of its impact on performance, especially in scenes with many LOD transitions.

Regarding the associated variable CVarLODTemporalLag:

The purpose of CVarLODTemporalLag is to provide a programmatic interface to access and modify the lod.TemporalLag value within the C++ code of Unreal Engine.

This variable is used in the Engine module, specifically in the scene management system. It’s defined in SceneManagement.cpp and used in the FTemporalLODState::UpdateTemporalLODTransition function.

The value of CVarLODTemporalLag is set when the lod.TemporalLag console variable is modified, either through code or console commands.

CVarLODTemporalLag directly interacts with the lod.TemporalLag console variable, serving as its C++ representation.

Developers should be aware that changes to CVarLODTemporalLag will affect the LOD transition behavior in the engine. It’s accessed using the GetValueOnRenderThread() method, indicating it’s used in render thread operations.

Best practices for using CVarLODTemporalLag include:

  1. Accessing it through the provided GetValueOnRenderThread() method when needed in render-related code.
  2. Avoiding frequent modifications to this variable, as it could impact rendering consistency.
  3. Considering its impact on both visual quality and performance when adjusting its value.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarLODTemporalLag(
	TEXT("lod.TemporalLag"),
	0.5f,
	TEXT("This controls the the time lag for temporal LOD, in seconds."),
	ECVF_Scalability | ECVF_Default);

bool AreCompressedTransformsSupported()
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneManagement.cpp:24

Scope: file

Source code excerpt:

#include "RenderGraphBuilder.h"

static TAutoConsoleVariable<float> CVarLODTemporalLag(
	TEXT("lod.TemporalLag"),
	0.5f,
	TEXT("This controls the the time lag for temporal LOD, in seconds."),
	ECVF_Scalability | ECVF_Default);

bool AreCompressedTransformsSupported()

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneManagement.cpp:79

Scope (from outer to inner):

file
function     void FTemporalLODState::UpdateTemporalLODTransition

Source code excerpt:

	{
		bOk = true;
		TemporalLODLag = CVarLODTemporalLag.GetValueOnRenderThread();
		if (TemporalLODTime[1] < LastRenderTime - TemporalLODLag)
		{
			if (TemporalLODTime[0] < TemporalLODTime[1])
			{
				TemporalLODViewOrigin[0] = TemporalLODViewOrigin[1];
				TemporalLODTime[0] = TemporalLODTime[1];