MaterialBaking.VTWarmupFrames
MaterialBaking.VTWarmupFrames
#Overview
name: MaterialBaking.VTWarmupFrames
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of frames to render for virtual texture warmup when material baking.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaterialBaking.VTWarmupFrames is to control the number of frames rendered for virtual texture warmup during material baking in Unreal Engine 5. This setting is primarily used in the material baking system, which is part of the rendering pipeline.
The Unreal Engine subsystem that relies on this setting variable is the Material Baking Module, as evidenced by its usage in the MaterialBakingModule.cpp file.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 5 frames, but can be changed at runtime through console commands or configuration files.
This variable interacts with the associated variable CVarMaterialBakingVTWarmupFrames, which is the actual console variable object. They share the same value, with MaterialBaking.VTWarmupFrames being the string name used to access the console variable.
Developers should be aware that this variable affects the performance and quality of material baking, especially when working with materials that use virtual textures. Increasing the number of warmup frames can potentially improve the quality of baked materials but at the cost of increased baking time.
Best practices when using this variable include:
- Keeping the default value unless specific issues with virtual texture baking are observed.
- Adjusting the value based on the complexity of the materials and virtual textures used in the project.
- Balancing between baking quality and performance, especially for projects with many materials to bake.
Regarding the associated variable CVarMaterialBakingVTWarmupFrames:
This is the actual TAutoConsoleVariable object that stores the value for MaterialBaking.VTWarmupFrames. It’s used internally by the engine to access and modify the setting.
The purpose of CVarMaterialBakingVTWarmupFrames is to provide a programmatic interface for the MaterialBaking.VTWarmupFrames setting within the C++ code of the engine.
This variable is used in the Material Baking Module to determine the number of warmup frames when baking materials with virtual textures.
The value of this variable is set when the engine initializes the console variables, but can be changed at runtime using console commands.
CVarMaterialBakingVTWarmupFrames interacts directly with the material baking process, influencing the rendering of warmup frames for virtual textures.
Developers should be aware that this is the actual variable used in the C++ code, and any runtime changes to MaterialBaking.VTWarmupFrames will be reflected in this variable.
Best practices include using the GetValueOnAnyThread() method to safely access the current value of the variable from any thread, as seen in the provided code excerpts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:64
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMaterialBakingVTWarmupFrames(
TEXT("MaterialBaking.VTWarmupFrames"),
5,
TEXT("Number of frames to render for virtual texture warmup when material baking."));
static TAutoConsoleVariable<bool> CVarMaterialBakingForceDisableEmissiveScaling(
TEXT("MaterialBaking.ForceDisableEmissiveScaling"),
false,
#Associated Variable and Callsites
This variable is associated with another variable named CVarMaterialBakingVTWarmupFrames
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:63
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarMaterialBakingVTWarmupFrames(
TEXT("MaterialBaking.VTWarmupFrames"),
5,
TEXT("Number of frames to render for virtual texture warmup when material baking."));
static TAutoConsoleVariable<bool> CVarMaterialBakingForceDisableEmissiveScaling(
TEXT("MaterialBaking.ForceDisableEmissiveScaling"),
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:347
Scope (from outer to inner):
file
function uint32 FMaterialBakingModule::GetCRC
Source code excerpt:
Ar << ColorSpace;
int32 VTWarmupFrames = CVarMaterialBakingVTWarmupFrames.GetValueOnAnyThread();
Ar << VTWarmupFrames;
bool ForceDisableEmissiveScaling = CVarMaterialBakingForceDisableEmissiveScaling.GetValueOnAnyThread();
Ar << ForceDisableEmissiveScaling;
return Ar.GetCrc();
#Loc: <Workspace>/Engine/Source/Developer/MaterialBaking/Private/MaterialBakingModule.cpp:740
Scope (from outer to inner):
file
class class FMaterialBakingProcessor
function void BakeMaterialProperty
lambda-function
Source code excerpt:
if (!MeshMaterial.GetUniformVirtualTextureExpressions().IsEmpty())
{
WarmupIterationCount = CVarMaterialBakingVTWarmupFrames.GetValueOnAnyThread();
}
}
// Do rendering
for (int WarmupIndex = 0; WarmupIndex < WarmupIterationCount; ++WarmupIndex)
{