r.PathTracing.WiperMode
r.PathTracing.WiperMode
#Overview
name: r.PathTracing.WiperMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables wiper mode to render using the path tracer only in a region of the screen for debugging purposes (default = 0, wiper mode disabled)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.WiperMode is to enable a debugging feature for the path tracing rendering system in Unreal Engine 5. It allows developers to render only a portion of the screen using the path tracer, creating a “wiper” effect for visual comparison and debugging.
This setting variable is primarily used in the rendering system, specifically within the path tracing module of Unreal Engine 5. Based on the callsites, it’s clear that this variable is utilized in the Renderer module, as evidenced by its location in the PathTracing.cpp file.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0 (disabled). Developers can change this value at runtime using console commands or through project settings.
The associated variable CVarPathTracingWiperMode directly interacts with r.PathTracing.WiperMode. They share the same value and purpose, with CVarPathTracingWiperMode being the actual C++ variable used in the code to access the setting.
Developers should be aware that enabling this variable will affect the rendering performance and visual output of the path tracing system. It’s intended for debugging purposes and should not be enabled in production builds.
Best practices when using this variable include:
- Only enable it during development and debugging sessions.
- Use it in conjunction with other debugging tools to isolate and identify path tracing issues.
- Remember to disable it before finalizing builds or performance testing.
- Be aware that it may interact with other rendering settings, so consider its effects in the context of the entire rendering pipeline.
Regarding CVarPathTracingWiperMode:
This is the C++ variable that directly represents r.PathTracing.WiperMode in the code. It’s used to check the current state of the wiper mode and control the rendering behavior accordingly. The code snippets show that when CVarPathTracingWiperMode is non-zero, it affects the viewport calculations for both the path tracing display and motion vector rendering.
Developers should use CVarPathTracingWiperMode when they need to programmatically check or modify the wiper mode state within C++ code. It’s important to access this variable using the GetValueOnRenderThread() method to ensure thread-safe operations, as demonstrated in the provided code excerpts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:243
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingWiperMode(
TEXT("r.PathTracing.WiperMode"),
0,
TEXT("Enables wiper mode to render using the path tracer only in a region of the screen for debugging purposes (default = 0, wiper mode disabled)"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarPathTracingProgressDisplay(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingWiperMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:242
Scope: file
Source code excerpt:
#endif // WITH_MGPU
TAutoConsoleVariable<int32> CVarPathTracingWiperMode(
TEXT("r.PathTracing.WiperMode"),
0,
TEXT("Enables wiper mode to render using the path tracer only in a region of the screen for debugging purposes (default = 0, wiper mode disabled)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:3336
Scope: file
Source code excerpt:
// wiper mode - reveals the render below the path tracing display
// NOTE: we still path trace the full resolution even while wiping the cursor so that rendering does not get out of sync
if (CVarPathTracingWiperMode.GetValueOnRenderThread() != 0)
{
float DPIScale = FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(View.CursorPos.X, View.CursorPos.Y);
if (IsCursorInsideView)
{
Viewport.Rect.Min.X = View.CursorPos.X / DPIScale;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:3394
Scope: file
Source code excerpt:
FScreenPassTextureViewport MotionVectorViewport(SceneColorOutputTexture, View.ViewRect);
if (CVarPathTracingWiperMode.GetValueOnRenderThread() != 0)
{
float DPIScale = FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(View.CursorPos.X, View.CursorPos.Y);
if (IsCursorInsideView)
{
MotionVectorViewport.Rect.Max.X = View.CursorPos.X / DPIScale;
}