r.RayTracing.SkyLight.HairVoxel
r.RayTracing.SkyLight.HairVoxel
#Overview
name: r.RayTracing.SkyLight.HairVoxel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Include hair voxel representation to estimate sky occlusion
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.SkyLight.HairVoxel is to control whether hair voxel representation is included in the estimation of sky occlusion for ray-traced skylights in Unreal Engine 5.
This setting variable is primarily used in the rendering system, specifically in the ray tracing subsystem for skylight calculations. It is part of the Renderer module, as evidenced by its location in the “Runtime/Renderer/Private/RayTracing” directory.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, meaning it is enabled by default.
The associated variable CVarRayTracingSkyLightEnableHairVoxel directly interacts with r.RayTracing.SkyLight.HairVoxel. They share the same value and purpose.
Developers must be aware that this variable affects the rendering of hair in ray-traced skylights. When enabled, it includes hair voxel representation in sky occlusion calculations, which can potentially improve the visual quality of hair rendering under skylights at the cost of additional computation.
Best practices when using this variable include:
- Consider the performance impact of enabling hair voxel representation in skylight calculations, especially for scenes with a lot of hair.
- Test the visual difference with the setting enabled and disabled to determine if the quality improvement justifies the performance cost for your specific use case.
- Be aware that this setting may interact with other hair rendering and ray tracing settings, so it should be considered as part of a holistic approach to hair rendering optimization.
Regarding the associated variable CVarRayTracingSkyLightEnableHairVoxel:
The purpose of CVarRayTracingSkyLightEnableHairVoxel is identical to r.RayTracing.SkyLight.HairVoxel, as it is the internal representation of the console variable in the C++ code.
This variable is used in the Renderer module, specifically in the ray tracing skylight rendering system.
The value is set through the CVar system and can be modified at runtime through console commands.
It interacts directly with the r.RayTracing.SkyLight.HairVoxel setting, as they represent the same configuration option.
Developers should be aware that this variable is checked on the render thread (ECVF_RenderThreadSafe flag), which means changes to its value will be applied on the next frame render.
Best practices for using this variable include:
- Access its value using GetValueOnRenderThread() when used in render thread operations.
- Consider caching the value if it’s accessed frequently to avoid potential performance overhead from repeated CVar lookups.
- Be cautious when changing this value dynamically, as it may impact rendering performance and visual consistency.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:99
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingSkyLightEnableHairVoxel(
TEXT("r.RayTracing.SkyLight.HairVoxel"),
1,
TEXT("Include hair voxel representation to estimate sky occlusion"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarRayTracingSkyLightScreenPercentage(
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingSkyLightEnableHairVoxel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:98
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarRayTracingSkyLightEnableHairVoxel(
TEXT("r.RayTracing.SkyLight.HairVoxel"),
1,
TEXT("Include hair voxel representation to estimate sky occlusion"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:453
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderRayTracingSkyLight
Source code excerpt:
HairStrands::HasViewHairStrandsData(View) &&
HairStrands::HasViewHairStrandsVoxelData(View) &&
CVarRayTracingSkyLightEnableHairVoxel.GetValueOnRenderThread() > 0;
if (bUseHairLighting)
{
PassParameters->VirtualVoxel = HairStrands::BindHairStrandsVoxelUniformParameters(View);
}
FRayTracingSkyLightRGS::FPermutationDomain PermutationVector;