r.ForceLODShadow

r.ForceLODShadow

#Overview

name: r.ForceLODShadow

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.ForceLODShadow is to force a specific Level of Detail (LOD) for shadow map generation in the rendering system. This setting allows developers to control the LOD used for shadow mapping independently of the main object rendering.

This setting variable is primarily used by Unreal Engine’s rendering subsystem, specifically in the shadow mapping component of the renderer. It’s defined in the RenderCore module, which is a core part of the engine’s rendering pipeline.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of -1, which means the feature is off by default. Developers can change this value at runtime using console commands or through configuration files.

The associated variable CVarForceLODShadow is the actual console variable object that stores and manages the r.ForceLODShadow setting. They share the same value and purpose.

Developers must be aware that:

  1. This variable affects only shadow map generation, not the overall LOD of objects in the scene.
  2. Setting a value other than -1 will force all shadow maps to use that specific LOD level, which may impact performance and visual quality.
  3. This setting is marked as scalable and render thread safe, meaning it can be adjusted for different quality settings and can be safely modified during rendering.

Best practices when using this variable include:

  1. Use it primarily for debugging or specific optimization scenarios.
  2. Be cautious when setting it to a non-default value in production, as it may impact performance or visual quality unexpectedly.
  3. When adjusting this value, also consider its impact on overall rendering performance and shadow quality.

Regarding the associated variable CVarForceLODShadow:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarForceLODShadow(
	TEXT("r.ForceLODShadow"),
	-1,
	TEXT("LOD level to force for the shadow map generation only, -1 is off."),
	ECVF_Scalability | ECVF_Default | ECVF_RenderThreadSafe
);

#endif // EXPOSE_FORCE_LOD

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

static TAutoConsoleVariable<int32> CVarForceLODShadow(
	TEXT("r.ForceLODShadow"),
	-1,
	TEXT("LOD level to force for the shadow map generation only, -1 is off."),
	ECVF_Scalability | ECVF_Default | ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     int32 GetCVarForceLODShadow

Source code excerpt:

#if EXPOSE_FORCE_LOD
	{
		Ret = CVarForceLODShadow.GetValueOnRenderThread();
	}
#endif // EXPOSE_FORCE_LOD

	return Ret;
}

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

Scope (from outer to inner):

file
function     int32 GetCVarForceLODShadow_AnyThread

Source code excerpt:

#if EXPOSE_FORCE_LOD
	{
		Ret = CVarForceLODShadow.GetValueOnAnyThread();
	}
#endif // EXPOSE_FORCE_LOD

	return Ret;
}