r.RayTracing.DebugTraversalScale.Triangle
r.RayTracing.DebugTraversalScale.Triangle
#Overview
name: r.RayTracing.DebugTraversalScale.Triangle
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scaling factor for triangle traversal heat map visualization. (default = 30)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.DebugTraversalScale.Triangle is to provide a scaling factor for triangle traversal heat map visualization in the ray tracing debug system of Unreal Engine 5.
This setting variable is primarily used in the rendering system, specifically within the ray tracing debug visualization subsystem. Based on the callsites, it’s part of the Renderer module in Unreal Engine 5.
The value of this variable is set as a console variable with a default value of 30.0f. It can be modified at runtime through the console or configuration files.
The variable interacts with other debug-related variables in the ray tracing system, such as CVarRayTracingDebugTraversalBoxScale and CVarRayTracingDebugTraversalClusterScale, which are used together to control various aspects of the debug visualization.
Developers should be aware that this variable is specifically for debugging purposes and affects the visualization of triangle traversal in ray tracing. It’s not intended for use in production builds or to affect actual ray tracing performance.
Best practices when using this variable include:
- Only modifying it when actively debugging ray tracing issues
- Experimenting with different values to find the most useful visualization for the specific debug scenario
- Resetting it to the default value (30.0f) when not actively using it to avoid confusion
Regarding the associated variable CVarRayTracingDebugTraversalTriangleScale:
This is the actual TAutoConsoleVariable instance that corresponds to the r.RayTracing.DebugTraversalScale.Triangle console variable. It’s used internally by the engine to store and retrieve the value set by the console variable.
The purpose of CVarRayTracingDebugTraversalTriangleScale is to provide programmatic access to the triangle traversal scale value within the C++ code of the engine.
It’s used in the RenderRayTracingDebug function of the FDeferredShadingSceneRenderer class to set the TraversalTriangleScale parameter for the ray tracing debug pass.
Developers working directly with the engine’s C++ code should use this variable (CVarRayTracingDebugTraversalTriangleScale) when they need to access or modify the triangle traversal scale value programmatically. They can use the GetValueOnAnyThread() method to retrieve the current value safely from any thread.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:84
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalTriangleScale(
TEXT("r.RayTracing.DebugTraversalScale.Triangle"),
30.0f,
TEXT("Scaling factor for triangle traversal heat map visualization. (default = 30)\n")
);
static TAutoConsoleVariable<int32> CVarRayTracingDebugHitCountMaxThreshold(
TEXT("r.RayTracing.DebugTriangleHitCount.MaxThreshold"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingDebugTraversalTriangleScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:83
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalTriangleScale(
TEXT("r.RayTracing.DebugTraversalScale.Triangle"),
30.0f,
TEXT("Scaling factor for triangle traversal heat map visualization. (default = 30)\n")
);
static TAutoConsoleVariable<int32> CVarRayTracingDebugHitCountMaxThreshold(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:1373
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderRayTracingDebug
Source code excerpt:
PassParameters->TraversalBoxScale = CVarRayTracingDebugTraversalBoxScale.GetValueOnAnyThread();
PassParameters->TraversalClusterScale = CVarRayTracingDebugTraversalClusterScale.GetValueOnAnyThread();
PassParameters->TraversalTriangleScale = CVarRayTracingDebugTraversalTriangleScale.GetValueOnAnyThread();
PassParameters->RTDebugVisualizationNaniteCutError = 0.0f;
RaytracingTraversalStatistics::FTraceRayInlineStatisticsData TraversalData;
if (bPrintTraversalStats)
{