r.RayTracing.Debug.InstanceOverlap.ShowWireframe
r.RayTracing.Debug.InstanceOverlap.ShowWireframe
#Overview
name: r.RayTracing.Debug.InstanceOverlap.ShowWireframe
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Show instance bounding boxes in wireframe in Instances Overlap mode. (default = 1)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Debug.InstanceOverlap.ShowWireframe is to control the visualization of instance bounding boxes in wireframe mode for ray tracing debug purposes, specifically in the Instances Overlap mode. This setting is part of Unreal Engine 5’s ray tracing debugging system.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the ray tracing debugging subsystem. It’s referenced in the RayTracingDebug.cpp file, which is part of the ray tracing debugging functionality.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning the wireframe visualization is enabled by default.
The associated variable CVarRayTracingDebugInstanceOverlapShowWireframe directly interacts with this setting. They share the same value and purpose.
Developers must be aware that this variable is specifically for debugging purposes and should not be relied upon for production gameplay or visuals. It’s intended to help visualize ray tracing instance overlaps during development and optimization phases.
Best practices when using this variable include:
- Use it temporarily during development for debugging ray tracing issues related to instance overlaps.
- Remember to disable it (set to 0) when not needed to avoid potential performance impact.
- Combine it with other ray tracing debugging tools for a comprehensive understanding of the ray tracing behavior in your scene.
Regarding the associated variable CVarRayTracingDebugInstanceOverlapShowWireframe:
This is the actual console variable that controls the setting. It’s an integer variable that determines whether to show instance bounding boxes in wireframe in the Instances Overlap mode.
It’s used in the DrawInstanceOverlap function to conditionally render the instance AABBs (Axis-Aligned Bounding Boxes) with lines. When the value is non-zero, the wireframe visualization is enabled.
Developers should be aware that this variable is checked on the render thread (GetValueOnRenderThread()), which means changes to this value will be reflected in the next frame.
The best practice for using this variable is to toggle it on when investigating instance overlap issues in ray tracing, and off when not needed to maintain optimal performance. It can be particularly useful when optimizing scene organization for ray tracing performance.
#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:78
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingDebugInstanceOverlapShowWireframe(
TEXT("r.RayTracing.Debug.InstanceOverlap.ShowWireframe"),
1,
TEXT("Show instance bounding boxes in wireframe in Instances Overlap mode. (default = 1)\n")
);
static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalTriangleScale(
TEXT("r.RayTracing.DebugTraversalScale.Triangle"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingDebugInstanceOverlapShowWireframe
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:77
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarRayTracingDebugInstanceOverlapShowWireframe(
TEXT("r.RayTracing.Debug.InstanceOverlap.ShowWireframe"),
1,
TEXT("Show instance bounding boxes in wireframe in Instances Overlap mode. (default = 1)\n")
);
static TAutoConsoleVariable<float> CVarRayTracingDebugTraversalTriangleScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:1284
Scope (from outer to inner):
file
function static void DrawInstanceOverlap
Source code excerpt:
// Draw instance AABB with lines
if (CVarRayTracingDebugInstanceOverlapShowWireframe.GetValueOnRenderThread() != 0)
{
RayTracingDrawInstances(GraphBuilder, View, SceneColorTexture, SceneDepthTexture, Scene->RayTracingScene.DebugInstanceGPUSceneIndexBuffer, true);
}
}
void FDeferredShadingSceneRenderer::RenderRayTracingDebug(FRDGBuilder& GraphBuilder, const FViewInfo& View, FRDGTextureRef SceneColorTexture, FRayTracingPickingFeedback& PickingFeedback)