r.HairStrands.Binding

r.HairStrands.Binding

#Overview

name: r.HairStrands.Binding

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.HairStrands.Binding is to enable or disable hair binding, which refers to hair attached to skeletal meshes in Unreal Engine 5’s rendering system.

This setting variable is primarily used by the Renderer module, specifically within the HairStrands subsystem. It’s part of the hair rendering and simulation features in Unreal Engine 5.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime.

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

Developers must be aware that this variable affects the performance and visual fidelity of hair rendering in the engine. Disabling it may improve performance but at the cost of visual quality for hair attached to skeletal meshes.

Best practices when using this variable include:

  1. Only disable it if performance is a critical issue and hair binding is not essential for your project.
  2. Test thoroughly after changing this setting, as it may significantly affect the appearance of characters or objects with hair.
  3. Consider exposing this setting to end-users in graphics options if hair quality vs. performance is a relevant trade-off in your game.

Regarding the associated variable CVarHairStrandsBinding:

The purpose of CVarHairStrandsBinding is to provide programmatic access to the r.HairStrands.Binding setting within the C++ code.

It’s used in the Renderer module to check if hair binding is enabled. The IsHairStrandsBindingEnable() function uses this variable to determine if the feature should be active.

The value of CVarHairStrandsBinding is set when the r.HairStrands.Binding console variable is modified.

Developers should be aware that this variable is marked as render thread safe and scalable, meaning it can be safely accessed from the render thread and may be adjusted based on scalability settings.

Best practices for using CVarHairStrandsBinding include:

  1. Use the IsHairStrandsBindingEnable() function to check the current state of hair binding.
  2. Avoid directly accessing the variable; instead, use the provided functions for thread-safe access.
  3. Consider the performance implications when enabling or disabling this feature in different parts of your game or application.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:87, section: [ConsoleVariables]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:57, section: [ConsoleVariables]

#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:43

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHairStrandsBinding(
	TEXT("r.HairStrands.Binding"), 1,
	TEXT("Enable/Disable hair binding, i.e., hair attached to skeletal meshes."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarHairStrandsSimulation(
	TEXT("r.HairStrands.Simulation"), 1,
	TEXT("Enable/disable hair simulation"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:42

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarHairStrandsBinding(
	TEXT("r.HairStrands.Binding"), 1,
	TEXT("Enable/Disable hair binding, i.e., hair attached to skeletal meshes."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarHairStrandsSimulation(
	TEXT("r.HairStrands.Simulation"), 1,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:207

Scope (from outer to inner):

file
function     bool IsHairStrandsBindingEnable

Source code excerpt:

bool IsHairStrandsBindingEnable()
{
	return CVarHairStrandsBinding.GetValueOnAnyThread() > 0;
}

bool IsHairStrandsSimulationEnable()
{
	return CVarHairStrandsSimulation.GetValueOnAnyThread() > 0;
}