MaterialBaking.RenderDocCapture
MaterialBaking.RenderDocCapture
#Overview
name: MaterialBaking.RenderDocCapture
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Determines whether or not to trigger a RenderDoc capture.\n0: Turned Off\n1: Turned On
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaterialBaking.RenderDocCapture is to control whether or not to trigger a RenderDoc capture during material baking. RenderDoc is a graphics debugging tool, and this setting allows developers to capture frame data for debugging and analysis purposes.
This setting variable is primarily used in the Material Baking system, which is part of Unreal Engine’s rendering and material processing pipeline. It’s specifically utilized in the MaterialBaking module.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0 (turned off). Developers can change this value at runtime using console commands or through code.
The associated variable CVarMaterialBakingRDOCCapture directly interacts with MaterialBaking.RenderDocCapture. They share the same value and purpose.
Developers must be aware that enabling this capture (by setting it to 1) may impact performance, as capturing frame data can be resource-intensive. It should primarily be used for debugging and not left enabled in production builds.
Best practices when using this variable include:
- Only enable it when necessary for debugging material baking issues.
- Disable it (set to 0) when not actively debugging to avoid performance impacts.
- Use it in conjunction with RenderDoc tool for effective graphics debugging.
- Be cautious when enabling in shipping builds or on lower-end hardware.
Regarding the associated variable CVarMaterialBakingRDOCCapture: This is the actual C++ variable that controls the RenderDoc capture functionality. It’s used in the code to check whether capture should be triggered. The variable is accessed using GetValueOnAnyThread() method, which suggests it can be safely read from any thread.
The CVarMaterialBakingRDOCCapture variable is used within a lambda function in the BakeMaterialProperty method of the FMaterialBakingProcessor class. This indicates that the RenderDoc capture is potentially triggered for each material property being baked.
Developers should be aware that changing the value of MaterialBaking.RenderDocCapture will directly affect the behavior of this CVarMaterialBakingRDOCCapture variable. Any code relying on this variable will be impacted by changes to the console variable setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:56
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMaterialBakingRDOCCapture(
TEXT("MaterialBaking.RenderDocCapture"),
0,
TEXT("Determines whether or not to trigger a RenderDoc capture.\n")
TEXT("0: Turned Off\n")
TEXT("1: Turned On"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarMaterialBakingRDOCCapture
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:55
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarMaterialBakingRDOCCapture(
TEXT("MaterialBaking.RenderDocCapture"),
0,
TEXT("Determines whether or not to trigger a RenderDoc capture.\n")
TEXT("0: Turned Off\n")
TEXT("1: Turned On"),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:718
Scope (from outer to inner):
file
class class FMaterialBakingProcessor
function void BakeMaterialProperty
lambda-function
Source code excerpt:
[RenderItem, RenderTarget, ExportMaterialProxy](FRHICommandListImmediate& RHICmdList)
{
RenderCaptureInterface::FScopedCapture RenderCapture(CVarMaterialBakingRDOCCapture.GetValueOnAnyThread() == 1, &RHICmdList, TEXT("MaterialBaking"));
FSceneViewFamily ViewFamily(FSceneViewFamily::ConstructionValues(RenderTarget->GetRenderTargetResource(), nullptr,
FEngineShowFlags(ESFIM_Game))
.SetTime(FGameTime()));
RenderItem->MaterialRenderProxy = ExportMaterialProxy;