r.HairStrands.Simulation
r.HairStrands.Simulation
#Overview
name: r.HairStrands.Simulation
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/disable hair simulation
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HairStrands.Simulation is to enable or disable hair simulation in Unreal Engine 5. This setting variable is part of the hair strands rendering system, which is responsible for realistic hair rendering and simulation in the engine.
This setting variable is primarily used by the Renderer module, specifically within the HairStrands subsystem. It’s defined and used in the HairStrandsInterface.cpp file, which is part of the hair strands rendering implementation.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning hair simulation is enabled by default. Developers can change this value at runtime using console commands or through project settings.
The associated variable CVarHairStrandsSimulation directly interacts with r.HairStrands.Simulation. They share the same value and purpose. The CVarHairStrandsSimulation is used in the C++ code to check the current state of hair simulation.
Developers must be aware that this variable affects the performance and visual quality of hair rendering in their games. Enabling hair simulation (value > 0) will provide more realistic hair movement but may have a performance cost.
Best practices when using this variable include:
- Consider the performance impact of enabling hair simulation, especially on lower-end hardware.
- Use it in conjunction with other hair-related settings for optimal results.
- Allow players to toggle this setting if hair simulation significantly impacts performance.
The associated variable CVarHairStrandsSimulation is used internally by the engine to query the current state of hair simulation. It’s used in the IsHairStrandsSimulationEnable() function, which likely controls whether hair simulation calculations are performed. Developers should use this function rather than directly accessing the CVar when checking if hair simulation is enabled in their code.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:85, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:55, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:48
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHairStrandsSimulation(
TEXT("r.HairStrands.Simulation"), 1,
TEXT("Enable/disable hair simulation"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarHairStrandsNonVisibleShadowCasting(
TEXT("r.HairStrands.Shadow.CastShadowWhenNonVisible"), 1,
TEXT("Enable shadow casting for hair strands even when culled out from the primary view"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarHairStrandsSimulation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:47
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarHairStrandsSimulation(
TEXT("r.HairStrands.Simulation"), 1,
TEXT("Enable/disable hair simulation"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarHairStrandsNonVisibleShadowCasting(
TEXT("r.HairStrands.Shadow.CastShadowWhenNonVisible"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:212
Scope (from outer to inner):
file
function bool IsHairStrandsSimulationEnable
Source code excerpt:
bool IsHairStrandsSimulationEnable()
{
return CVarHairStrandsSimulation.GetValueOnAnyThread() > 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FHairGroupPublicData::FHairGroupPublicData(uint32 InGroupIndex, const FName& InOwnerName)
{