r.RayTracing.Debug.PickerDomain
r.RayTracing.Debug.PickerDomain
#Overview
name: r.RayTracing.Debug.PickerDomain
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Changes the picker domain to highlight:\n0 - Triangles (default)\n1 - Instances\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Debug.PickerDomain is to control the domain for debugging ray tracing in Unreal Engine’s rendering system. It allows developers to switch between highlighting triangles or instances during ray tracing debug visualization.
This setting variable is primarily used in the ray tracing debug subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the RayTracingDebug.cpp file, which is part of the Renderer module.
The value of this variable is set through a console command. It’s defined as a TAutoConsoleVariable with default value 0, which corresponds to the triangle domain. The value can be changed at runtime using the console command “r.RayTracing.Debug.PickerDomain”.
The associated variable CVarRayTracingDebugPickerDomain interacts directly with r.RayTracing.Debug.PickerDomain. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the visualization mode in ray tracing debugging. When set to 0, it highlights triangles, and when set to 1, it highlights instances. This can be crucial for isolating and diagnosing issues in ray tracing rendering.
Best practices when using this variable include:
- Use it in conjunction with other ray tracing debug tools for comprehensive debugging.
- Switch between triangle and instance domains to get a complete picture of the ray tracing process.
- Be aware that changing this value may impact performance during debugging, so use it judiciously in performance-critical scenarios.
Regarding the associated variable CVarRayTracingDebugPickerDomain:
The purpose of CVarRayTracingDebugPickerDomain is to provide a programmatic way to access and modify the r.RayTracing.Debug.PickerDomain setting within C++ code.
This variable is used in the same Renderer module, specifically in the ray tracing debug subsystem. It’s accessed in the RenderRayTracingDebug and RayTracingDisplayPicking functions to determine the current picker domain for debug visualization.
The value of CVarRayTracingDebugPickerDomain is set automatically when r.RayTracing.Debug.PickerDomain is modified, as they share the same underlying value.
CVarRayTracingDebugPickerDomain interacts directly with r.RayTracing.Debug.PickerDomain and is used to read the current value in C++ code.
Developers should be aware that this variable is thread-safe and can be accessed from the render thread using GetValueOnRenderThread().
Best practices for using CVarRayTracingDebugPickerDomain include:
- Always use GetValueOnRenderThread() when accessing it from render thread code.
- Be cautious about caching its value, as it can be changed at runtime through the console command.
- Use it in conjunction with other debug variables and systems for comprehensive ray tracing debugging.
#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:32
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarRayTracingDebugPickerDomain(
TEXT("r.RayTracing.Debug.PickerDomain"),
0,
TEXT("Changes the picker domain to highlight:\n")
TEXT("0 - Triangles (default)\n")
TEXT("1 - Instances\n"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingDebugPickerDomain
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:31
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarRayTracingDebugPickerDomain(
TEXT("r.RayTracing.Debug.PickerDomain"),
0,
TEXT("Changes the picker domain to highlight:\n")
TEXT("0 - Triangles (default)\n")
TEXT("1 - Instances\n"),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:1505
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderRayTracingDebug
Source code excerpt:
RayGenParameters->VisualizationMode = DebugVisualizationMode;
RayGenParameters->PickerDomain = CVarRayTracingDebugPickerDomain.GetValueOnRenderThread();
RayGenParameters->ShouldUsePreExposure = View.Family->EngineShowFlags.Tonemapper;
RayGenParameters->TimingScale = CVarRayTracingDebugTimingScale.GetValueOnAnyThread() / 25000.0f;
RayGenParameters->OpaqueOnly = CVarRayTracingDebugModeOpaqueOnly.GetValueOnRenderThread();
RayGenParameters->TriangleHitCountMaxThreshold = FMath::Clamp((float)CVarRayTracingDebugHitCountMaxThreshold.GetValueOnRenderThread(), 1, 100000);
RayGenParameters->TriangleHitCountPerInstanceMaxThreshold = FMath::Max(1, CVarRayTracingDebugHitCountPerInstanceMaxThreshold.GetValueOnRenderThread());
RayGenParameters->RayTracingDebugHitStatsUniformBuffer = DebugHitStatsUniformBuffer;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDebug.cpp:1585
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RayTracingDisplayPicking
Source code excerpt:
}
int32 PickerDomain = CVarRayTracingDebugPickerDomain.GetValueOnRenderThread();
switch (PickerDomain)
{
case RAY_TRACING_DEBUG_PICKER_DOMAIN_TRIANGLE:
Writer.DrawLine(FText::FromString(TEXT("Domain [Triangle]")), 10, FColor::Yellow);
break;