r.PathTracing.UseDBuffer

r.PathTracing.UseDBuffer

#Overview

name: r.PathTracing.UseDBuffer

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.PathTracing.UseDBuffer is to control whether DBuffer functionality is supported in the path tracing system of Unreal Engine 5. DBuffer, or Decal Buffer, is typically used for efficient rendering of decals in a deferred rendering pipeline.

This setting variable is primarily used in the rendering system, specifically in the path tracing subsystem of Unreal Engine 5. Based on the callsites, it’s clear that this variable is utilized in the Renderer module, particularly in the PathTracing.cpp file.

The value of this variable is set through a console variable (CVarPathTracingUseDBuffer) with a default value of 1, meaning DBuffer functionality is enabled by default. It can be changed at runtime using console commands or through project settings.

The associated variable CVarPathTracingUseDBuffer interacts directly with r.PathTracing.UseDBuffer. It’s an instance of TAutoConsoleVariable that allows for runtime modification of the setting.

Developers should be aware that this variable affects the path tracing rendering pipeline. Enabling or disabling DBuffer functionality could impact the rendering of decals in path-traced scenes. It’s important to consider the performance implications and visual quality trade-offs when modifying this setting.

Best practices when using this variable include:

  1. Only disable it if you’re certain you don’t need DBuffer functionality in your path-traced scenes.
  2. Test your scenes with both enabled and disabled states to ensure optimal performance and visual quality.
  3. Consider the interaction with other decal-related settings, such as CVarPathTracingDecalRoughnessCutoff.

Regarding the associated variable CVarPathTracingUseDBuffer:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:294

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPathTracingUseDBuffer(
	TEXT("r.PathTracing.UseDBuffer"),
	1,
	TEXT("Whether to support DBuffer functionality (default=1)"),
	ECVF_RenderThreadSafe
);

TAutoConsoleVariable<float> CVarPathTracingDecalRoughnessCutoff(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:293

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<int32> CVarPathTracingUseDBuffer(
	TEXT("r.PathTracing.UseDBuffer"),
	1,
	TEXT("Whether to support DBuffer functionality (default=1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:671

Scope (from outer to inner):

file
function     static void PreparePathTracingData

Source code excerpt:

	PathTracingData.VolumeFlags |= EvalUseAnalyticTransmittance(View) ? PATH_TRACER_VOLUME_USE_ANALYTIC_TRANSMITTANCE : 0;

	PathTracingData.EnableDBuffer = CVarPathTracingUseDBuffer.GetValueOnRenderThread();

	PathTracingData.DecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && View.bHasRayTracingDecals ? CVarPathTracingDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;

	PathTracingData.MeshDecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && Scene->RayTracingScene.GetRHIRayTracingScene()->GetInitializer().NumNativeInstancesPerLayer[(uint32)ERayTracingSceneLayer::Decals] > 0 ? CVarPathTracingMeshDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;
	PathTracingData.MeshDecalBias = CVarPathTracingMeshDecalBias.GetValueOnRenderThread();