r.HairStrands.Visibility.NonVisibleShadowCasting.Debug
r.HairStrands.Visibility.NonVisibleShadowCasting.Debug
#Overview
name: r.HairStrands.Visibility.NonVisibleShadowCasting.Debug
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable debug rendering for non-visible hair strands instance, casting shadow.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HairStrands.Visibility.NonVisibleShadowCasting.Debug is to enable debug rendering for non-visible hair strands instances that are casting shadows in Unreal Engine 5’s hair rendering system.
This setting variable is primarily used by the hair strands rendering subsystem within Unreal Engine’s renderer module. It is specifically related to the visibility and shadow casting aspects of hair rendering.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is defined as a TAutoConsoleVariable with an initial value of 0, meaning the debug rendering is disabled by default.
The associated variable CVarHairStrandsNonVisibleShadowCasting_Debug directly interacts with this setting. They share the same value and purpose.
Developers must be aware that this is a debug feature and should only be enabled when troubleshooting or analyzing the hair strands rendering system, particularly for non-visible instances that are still casting shadows. Enabling this feature may have performance implications, so it should be used judiciously.
Best practices when using this variable include:
- Only enable it when necessary for debugging purposes.
- Be mindful of potential performance impacts when enabled.
- Use it in conjunction with other hair strands debugging tools for comprehensive analysis.
- Disable it in production builds to avoid unnecessary overhead.
Regarding the associated variable CVarHairStrandsNonVisibleShadowCasting_Debug:
This is the actual C++ variable that controls the debug rendering feature. It is defined as a static TAutoConsoleVariable
The purpose of this variable is the same as r.HairStrands.Visibility.NonVisibleShadowCasting.Debug - to enable debug rendering for non-visible hair strands instances that are casting shadows.
This variable is used in the IsHairStrandsVisibleInShadows function to determine whether the debug rendering should be enabled. When the value is greater than 0, it triggers additional debug data collection and potentially visualization of non-visible hair strands that are casting shadows.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which is important for thread safety in the rendering pipeline.
Best practices for using this variable include:
- Access it only on the render thread to maintain thread safety.
- Use it in conjunction with other debugging tools and variables for hair strands rendering.
- Consider the performance impact when enabling this debug feature, especially in complex scenes with many hair instances.
- Ensure it’s disabled in release builds to prevent any unnecessary performance overhead.
#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:63
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHairStrandsNonVisibleShadowCasting_Debug(
TEXT("r.HairStrands.Visibility.NonVisibleShadowCasting.Debug"), 0,
TEXT("Enable debug rendering for non-visible hair strands instance, casting shadow."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsContinuousDecimationReordering(
TEXT("r.HairStrands.ContinuousDecimationReordering"), 0,
TEXT("Enable strand reordering to allow Continuous LOD. Experimental"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarHairStrandsNonVisibleShadowCasting_Debug
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:62
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsNonVisibleShadowCasting_Debug(
TEXT("r.HairStrands.Visibility.NonVisibleShadowCasting.Debug"), 0,
TEXT("Enable debug rendering for non-visible hair strands instance, casting shadow."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarHairStrandsContinuousDecimationReordering(
TEXT("r.HairStrands.ContinuousDecimationReordering"), 0,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsInterface.cpp:231
Scope (from outer to inner):
file
function bool IsHairStrandsVisibleInShadows
Source code excerpt:
bool IsHairStrandsVisibleInShadows(const FViewInfo& View, const FHairStrandsInstance& Instance)
{
const bool bDebugEnable = CVarHairStrandsNonVisibleShadowCasting_Debug.GetValueOnRenderThread() > 0;
FHairStrandsDebugData::FCullData* CullingData = nullptr;
if (bDebugEnable)
{
CullingData = const_cast<FHairStrandsDebugData::FCullData*>(&View.HairStrandsViewData.DebugData.CullData);
CullingData->bIsValid = true;
CullingData->ViewFrustum = View.ViewFrustum;