r.HairStrands.LODMode

r.HairStrands.LODMode

#Overview

name: r.HairStrands.LODMode

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 r.HairStrands.LODMode is to control the Level of Detail (LOD) mode for hair strands rendering in Unreal Engine 5. It determines whether the engine uses an automatic LOD system or a manual LOD system for hair strands.

This setting variable is primarily used by the rendering system, specifically for the hair strands rendering feature. It’s part of the RenderCore module, as evident from its location in the RenderCore/Private/RenderUtils.cpp file.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, which enables the Auto LOD mode by default. The value can be changed at runtime through console commands or programmatically.

The associated variable CVarHairStrandsLODMode directly interacts with r.HairStrands.LODMode. They share the same value and purpose.

Developers must be aware that:

  1. This setting affects the performance and visual quality of hair rendering.
  2. The value is clamped between 0 and 1, where 0 represents Manual LOD mode and 1 represents Auto LOD mode.
  3. While this sets a global behavior, it can be overridden per groom asset.

Best practices when using this variable include:

  1. Consider the performance implications of Auto LOD vs. Manual LOD for your specific use case.
  2. If using Manual LOD mode, ensure that LODs are properly set up for each groom asset.
  3. Test both modes to determine which provides the best balance of performance and visual quality for your project.

Regarding the associated variable CVarHairStrandsLODMode:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHairStrandsLODMode(
	TEXT("r.HairStrands.LODMode"),
	1,
	TEXT("Enable hair strands Auto LOD mode by default. Otherwise use Manual LOD mode. Auto LOD mode adapts hair curves based on screen coverage. Manual LOD mode relies on LODs manually setup per groom asset. This global behavior can be overridden per groom asset."),
	ECVF_RenderThreadSafe);

int32 GetLightFunctionAtlasFormat()
{

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarHairStrandsLODMode(
	TEXT("r.HairStrands.LODMode"),
	1,
	TEXT("Enable hair strands Auto LOD mode by default. Otherwise use Manual LOD mode. Auto LOD mode adapts hair curves based on screen coverage. Manual LOD mode relies on LODs manually setup per groom asset. This global behavior can be overridden per groom asset."),
	ECVF_RenderThreadSafe);

int32 GetLightFunctionAtlasFormat()

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

Scope (from outer to inner):

file
function     uint32 GetHairStrandsLODMode

Source code excerpt:

uint32 GetHairStrandsLODMode()
{
	return FMath::Clamp(CVarHairStrandsLODMode.GetValueOnAnyThread(), 0, 1);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// Substrate settings interface

static TAutoConsoleVariable<int32> CVarSubstrate(