r.OIT.SortedPixels.Debug

r.OIT.SortedPixels.Debug

#Overview

name: r.OIT.SortedPixels.Debug

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.OIT.SortedPixels.Debug is to enable debug rendering for Order-Independent Transparency (OIT) in Unreal Engine 5. This setting variable is primarily used for the rendering system, specifically for debugging OIT-related features.

This setting variable is relied upon by the Renderer module of Unreal Engine, particularly within the OIT subsystem. The variable is defined and used in the OIT.cpp file, which is part of the Runtime/Renderer/Private/OIT directory.

The value of this variable is set through a console variable (CVarOIT_SortedPixels_Debug) with an initial value of 0. It can be changed at runtime through console commands or programmatically.

The variable interacts with the OIT system and is used to determine whether to add a debug pass for OIT pixel rendering. It works in conjunction with the OITData structure, which contains information about the OIT pass type.

Developers must be aware that this variable has specific debug modes:

  1. A value of 1 enables debug rendering for standard translucency.
  2. A value of 2 enables debug rendering for separated translucency.
  3. A value of 0 (default) disables debug rendering.

Best practices when using this variable include:

  1. Use it only for debugging purposes, as it may impact performance.
  2. Be aware of the different debug modes and their implications.
  3. Remember to disable it (set to 0) in production builds.

Regarding the associated variable CVarOIT_SortedPixels_Debug:

The purpose of CVarOIT_SortedPixels_Debug is to provide a console-accessible way to control the r.OIT.SortedPixels.Debug setting. It is an instance of TAutoConsoleVariable, which allows for runtime modification of the debug setting.

This variable is defined and used in the same Renderer module, specifically in the OIT.cpp file. Its value is set through the console variable system and can be modified at runtime.

CVarOIT_SortedPixels_Debug directly controls the behavior of the r.OIT.SortedPixels.Debug setting. It is used in the AddInternalOITComposePass function to determine whether to add the OIT pixel debug pass.

Developers should be aware that changes to CVarOIT_SortedPixels_Debug will immediately affect the OIT debug rendering. They should also note that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread.

Best practices for using CVarOIT_SortedPixels_Debug include:

  1. Use it for real-time debugging and testing of OIT-related features.
  2. Be cautious when modifying it in a shipping build, as it may affect performance.
  3. Consider exposing it through a debug menu for easier access during development and testing.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:73

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Debug(
	TEXT("r.OIT.SortedPixels.Debug"),
	0,
	TEXT("Enable debug rendering for OIT. 1: Enable debug for std. translucency 2: Enable for separated translucency."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Method(
	TEXT("r.OIT.SortedPixels.Method"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:72

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Debug(
	TEXT("r.OIT.SortedPixels.Debug"),
	0,
	TEXT("Enable debug rendering for OIT. 1: Enable debug for std. translucency 2: Enable for separated translucency."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Method(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:235

Scope (from outer to inner):

file
function     static void AddInternalOITComposePass

Source code excerpt:


	// Add debug pass
	const uint32 ActiveDebugPass = CVarOIT_SortedPixels_Debug.GetValueOnRenderThread();
	if (ActiveDebugPass == OITData.PassType)
	{
		AddOITPixelDebugPass(GraphBuilder, View, OITData);
	}
}