r.HairStrands.LODMode
r.HairStrands.LODMode
#Overview
name: r.HairStrands.LODMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
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.
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:
- This setting affects the performance and visual quality of hair rendering.
- The value is clamped between 0 and 1, where 0 represents Manual LOD mode and 1 represents Auto LOD mode.
- While this sets a global behavior, it can be overridden per groom asset.
Best practices when using this variable include:
- Consider the performance implications of Auto LOD vs. Manual LOD for your specific use case.
- If using Manual LOD mode, ensure that LODs are properly set up for each groom asset.
- Test both modes to determine which provides the best balance of performance and visual quality for your project.
Regarding the associated variable CVarHairStrandsLODMode:
- Its purpose is the same as r.HairStrands.LODMode, serving as the actual console variable that stores and manages the LOD mode setting.
- It’s used in the RenderCore module to retrieve the current LOD mode setting.
- The value is set through the console variable system and can be accessed on any thread.
- It’s used in the GetHairStrandsLODMode() function to return the current LOD mode, ensuring the value is always within the valid range (0 or 1).
- Developers should use this variable when they need to programmatically check or modify the hair strands LOD mode at runtime.
#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(