r.HairStrands.Visibility.ComputeRaster
r.HairStrands.Visibility.ComputeRaster
#Overview
name: r.HairStrands.Visibility.ComputeRaster
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Hair Visiblity uses raster compute. Experimental
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HairStrands.Visibility.ComputeRaster is to enable or disable the use of compute raster for hair visibility calculations in Unreal Engine’s rendering system. This setting is part of the Hair Strands rendering subsystem, which is responsible for rendering realistic hair and fur in the engine.
This setting variable is primarily used by the Renderer module, specifically within the Hair Strands rendering subsystem. It is defined and used in the HairStrandsInterface.cpp file, which is part of the runtime renderer implementation.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is initialized with a default value of 0, meaning it is disabled by default.
The associated variable CVarHairStrandsVisibilityComputeRaster interacts directly with r.HairStrands.Visibility.ComputeRaster. They share the same value and are used interchangeably in the code.
Developers should be aware that this feature is marked as “Experimental” in the code comments. This indicates that it may not be fully stable or optimized for production use. Additionally, the variable accepts different values:
- 0: Disabled (default)
- 1: Enabled
- 2: Enabled for forward rendering on SM6 (Shader Model 6) and above
Best practices when using this variable include:
- Testing thoroughly before enabling in production, as it’s experimental.
- Considering performance implications, as compute raster techniques may have different performance characteristics compared to traditional rasterization.
- Ensuring the target platforms support the required shader model (SM6) when using the forward rendering option.
- Using in conjunction with other hair strands settings for optimal results.
Regarding the associated variable CVarHairStrandsVisibilityComputeRaster:
The purpose of CVarHairStrandsVisibilityComputeRaster is to provide a programmatic way to access and modify the r.HairStrands.Visibility.ComputeRaster setting within the C++ code.
This variable is used in the Renderer module, specifically in the Hair Strands rendering subsystem. It’s defined in the same file (HairStrandsInterface.cpp) and is used to check the current state of the compute raster feature.
The value of this variable is set through the CVar system, mirroring the r.HairStrands.Visibility.ComputeRaster setting.
CVarHairStrandsVisibilityComputeRaster interacts with other hair strands-related variables, such as CVarHairStrandsVisibilityComputeRaster_ContinuousLOD, which enables continuous LOD when using compute rasterization.
Developers should be aware that this variable is used in various functions to determine the state of the compute raster feature, such as IsHairVisibilityComputeRasterEnabled() and IsHairVisibilityComputeRasterForwardEnabled().
Best practices for using this variable include:
- Using the provided functions (like IsHairVisibilityComputeRasterEnabled()) to check the feature state rather than accessing the variable directly.
- Consider the implications on other related features, such as continuous LOD, when modifying this setting.
- Be mindful of the render thread safety, as indicated by the ECVF_RenderThreadSafe flag in the variable definition.
#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:73
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHairStrandsVisibilityComputeRaster(
TEXT("r.HairStrands.Visibility.ComputeRaster"), 0,
TEXT("Hair Visiblity uses raster compute. Experimental"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsVisibilityComputeRaster_ContinuousLOD(
TEXT("r.HairStrands.Visibility.ComputeRaster.ContinuousLOD"), 1,
TEXT("Enable Continuos LOD when using compute rasterization. Experimental"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarHairStrandsVisibilityComputeRaster
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:72
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarHairStrandsVisibilityComputeRaster(
TEXT("r.HairStrands.Visibility.ComputeRaster"), 0,
TEXT("Hair Visiblity uses raster compute. Experimental"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsVisibilityComputeRaster_ContinuousLOD(
TEXT("r.HairStrands.Visibility.ComputeRaster.ContinuousLOD"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:318
Scope (from outer to inner):
file
function bool IsHairVisibilityComputeRasterEnabled
Source code excerpt:
bool IsHairVisibilityComputeRasterEnabled()
{
return CVarHairStrandsVisibilityComputeRaster.GetValueOnAnyThread() == 1;
}
bool IsHairVisibilityComputeRasterForwardEnabled(EShaderPlatform InPlatform)
{
return IsFeatureLevelSupported(InPlatform, ERHIFeatureLevel::SM6) && CVarHairStrandsVisibilityComputeRaster.GetValueOnAnyThread() == 2;
}
bool IsHairVisibilityComputeRasterContinuousLODEnabled()
{
return IsHairStrandContinuousDecimationReorderingEnabled() && IsHairVisibilityComputeRasterEnabled() && (CVarHairStrandsVisibilityComputeRaster_ContinuousLOD.GetValueOnAnyThread() > 0);
}