r.RayTracing.DebugTraversalScale.Box

r.RayTracing.DebugTraversalScale.Box

#Overview

name: r.RayTracing.DebugTraversalScale.Box

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.RayTracing.DebugTraversalScale.Box is to control the scaling factor for box traversal heat map visualization in the ray tracing debug system of Unreal Engine 5. This setting variable is primarily used for debugging and performance analysis of the ray tracing rendering system.

This setting variable is utilized by the Renderer module, specifically within the ray tracing debug functionality. It’s part of the ray tracing visualization tools that help developers understand and optimize the performance of ray tracing in their scenes.

The value of this variable is set as a console variable with a default value of 150.0f. It can be modified at runtime through the console or configuration files.

The associated variable CVarRayTracingDebugTraversalBoxScale directly interacts with r.RayTracing.DebugTraversalScale.Box. They share the same value and purpose.

Developers should be aware that this variable is specifically for debugging purposes and visualizing the performance of box traversal in ray tracing. It’s not intended for use in production builds or to affect the actual rendering quality.

Best practices when using this variable include:

  1. Use it in conjunction with other ray tracing debug tools for a comprehensive understanding of ray tracing performance.
  2. Experiment with different scale values to find the most informative visualization for your specific scene.
  3. Remember to disable or remove references to this debug feature in release builds.

Regarding the associated variable CVarRayTracingDebugTraversalBoxScale:

The purpose of CVarRayTracingDebugTraversalBoxScale is identical to r.RayTracing.DebugTraversalScale.Box. It’s the C++ variable that directly holds and provides access to the console variable’s value within the engine’s code.

This variable is used in the Renderer module, specifically in the RayTracingDebug.cpp file. It’s accessed in the RenderRayTracingDebug function of the FDeferredShadingSceneRenderer class.

The value of CVarRayTracingDebugTraversalBoxScale is set when the console variable r.RayTracing.DebugTraversalScale.Box is initialized or changed.

It interacts directly with the PassParameters->TraversalBoxScale in the ray tracing debug pass.

Developers should be aware that this variable provides the actual value used in the engine’s code, and any changes to the console variable will be reflected through this C++ variable.

Best practices include using GetValueOnAnyThread() when accessing the value, as shown in the provided code snippet, to ensure thread-safe access to the variable’s current value.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalBoxScale(
	TEXT("r.RayTracing.DebugTraversalScale.Box"),
	150.0f,
	TEXT("Scaling factor for box traversal heat map visualization. (default = 150)\n")
);

static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalClusterScale(
	TEXT("r.RayTracing.DebugTraversalScale.Cluster"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:53

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalBoxScale(
	TEXT("r.RayTracing.DebugTraversalScale.Box"),
	150.0f,
	TEXT("Scaling factor for box traversal heat map visualization. (default = 150)\n")
);

static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalClusterScale(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:1371

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderRayTracingDebug

Source code excerpt:


		PassParameters->VisualizationMode = DebugVisualizationMode;
		PassParameters->TraversalBoxScale = CVarRayTracingDebugTraversalBoxScale.GetValueOnAnyThread();
		PassParameters->TraversalClusterScale = CVarRayTracingDebugTraversalClusterScale.GetValueOnAnyThread();
		PassParameters->TraversalTriangleScale = CVarRayTracingDebugTraversalTriangleScale.GetValueOnAnyThread();

		PassParameters->RTDebugVisualizationNaniteCutError = 0.0f;

		RaytracingTraversalStatistics::FTraceRayInlineStatisticsData TraversalData;