r.HairStrands.Strands.UseTriangleStrips
r.HairStrands.Strands.UseTriangleStrips
#Overview
name: r.HairStrands.Strands.UseTriangleStrips
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable triangle strip geometry for hair strands rendering. This improves performances, but removes the last segments of each curve.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HairStrands.Strands.UseTriangleStrips is to enable or disable the use of triangle strip geometry for hair strands rendering in Unreal Engine 5. This setting is specifically for the rendering system, particularly for hair rendering optimization.
This setting variable is primarily used in the RenderCore module of Unreal Engine 5, which is responsible for low-level rendering functionalities. Based on the callsites, it’s clear that this variable is part of the hair rendering subsystem.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime through console commands or configuration files.
The associated variable CVarHairStrandsUsesTriangleStrips directly interacts with r.HairStrands.Strands.UseTriangleStrips. They share the same value and purpose.
Developers must be aware of the following when using this variable:
- Enabling this feature (value > 0) improves rendering performance.
- However, it removes the last segments of each hair curve, which might affect the visual quality of hair rendering.
- This setting is marked as read-only and render thread safe, meaning it should not be changed frequently during gameplay.
Best practices when using this variable include:
- Test the visual impact of enabling/disabling this feature in your specific use case.
- Consider the trade-off between performance improvement and potential loss of visual fidelity.
- If you decide to change this setting, do so during level loading or other appropriate times, not continuously during gameplay.
Regarding the associated variable CVarHairStrandsUsesTriangleStrips:
- It’s the actual console variable that controls the r.HairStrands.Strands.UseTriangleStrips setting.
- It’s defined as a TAutoConsoleVariable
, allowing for runtime changes. - The GetHairStrandsUsesTriangleStrips() function is provided to safely access this variable’s value from any thread.
- When using this variable in code, always use the provided getter function (GetHairStrandsUsesTriangleStrips()) instead of accessing the CVar directly to ensure thread-safe access.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1684
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHairStrandsUsesTriangleStrips(
TEXT("r.HairStrands.Strands.UseTriangleStrips"),
1,
TEXT("Enable triangle strip geometry for hair strands rendering. This improves performances, but removes the last segments of each curve."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsLODMode(
TEXT("r.HairStrands.LODMode"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarHairStrandsUsesTriangleStrips
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1683
Scope: file
Source code excerpt:
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsUsesTriangleStrips(
TEXT("r.HairStrands.Strands.UseTriangleStrips"),
1,
TEXT("Enable triangle strip geometry for hair strands rendering. This improves performances, but removes the last segments of each curve."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsLODMode(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1722
Scope (from outer to inner):
file
function bool GetHairStrandsUsesTriangleStrips
Source code excerpt:
bool GetHairStrandsUsesTriangleStrips()
{
return CVarHairStrandsUsesTriangleStrips.GetValueOnAnyThread() > 0;
}
uint32 GetHairStrandsLODMode()
{
return FMath::Clamp(CVarHairStrandsLODMode.GetValueOnAnyThread(), 0, 1);
}