landscape.DumpHeightmapDiff
landscape.DumpHeightmapDiff
#Overview
name: landscape.DumpHeightmapDiff
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This will save images for readback heightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.DumpHeightmapDiff
is to control the debugging functionality for landscape heightmap changes in Unreal Engine 5. This console variable is used to save images of readback heightmap textures that have changed during the last edit layer blend phase.
This setting variable is primarily used in the Landscape module of Unreal Engine 5, specifically within the landscape editing and rendering systems. It’s part of the debugging and development tools for landscape creation and modification.
The value of this variable is set through the console or configuration files. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands.
The variable interacts with several other debugging and optimization variables in the Landscape module, such as CVarLandscapeDumpWeightmapDiff
and CVarLandscapeDumpDiffDetails
.
Developers should be aware that this variable is primarily for debugging purposes. It can have performance implications when enabled, as it involves saving image data. The variable accepts three values:
- 0: No diff (default)
- 1: Dump Mip 0 diff
- 2: Dump all Mips diff
Best practices when using this variable include:
- Only enable it when necessary for debugging heightmap changes.
- Be mindful of potential performance impacts, especially when set to 2 (all Mips).
- Use in conjunction with other landscape debugging tools for comprehensive analysis.
Regarding the associated variable CVarLandscapeDumpHeightmapDiff
:
This is the actual C++ variable that corresponds to the console variable landscape.DumpHeightmapDiff
. It’s used within the engine code to check the current value of the setting and determine the appropriate behavior.
The purpose of CVarLandscapeDumpHeightmapDiff
is to provide a programmatic interface to the console variable within the C++ code. It’s used in the ALandscape::OnDirtyHeightmap
function to determine whether and how to dump heightmap differences.
This variable is part of the Landscape module and is primarily used in landscape editing and rendering systems.
The value of CVarLandscapeDumpHeightmapDiff
is set automatically based on the console variable landscape.DumpHeightmapDiff
. It’s accessed using the GetValueOnGameThread()
method.
Developers should be aware that this variable reflects the current state of the console variable and should be used when implementing heightmap diff dumping functionality in C++ code.
Best practices for using CVarLandscapeDumpHeightmapDiff
include:
- Always access its value using
GetValueOnGameThread()
to ensure thread-safety. - Use it in conjunction with other related variables like
CVarLandscapeDumpDiffDetails
for comprehensive debugging. - Consider performance implications when frequently checking or using this variable in performance-critical code paths.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:131
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLandscapeDumpHeightmapDiff(
TEXT("landscape.DumpHeightmapDiff"),
0,
TEXT("This will save images for readback heightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff"));
static TAutoConsoleVariable<int32> CVarLandscapeDumpWeightmapDiff(
TEXT("landscape.DumpWeightmapDiff"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeDumpHeightmapDiff
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:130
Scope: file
Source code excerpt:
TEXT("This will enable landscape layers optim."));
static TAutoConsoleVariable<int32> CVarLandscapeDumpHeightmapDiff(
TEXT("landscape.DumpHeightmapDiff"),
0,
TEXT("This will save images for readback heightmap textures that have changed in the last edit layer blend phase. (= 0 No Diff, 1 = Mip 0 Diff, 2 = All Mips Diff"));
static TAutoConsoleVariable<int32> CVarLandscapeDumpWeightmapDiff(
TEXT("landscape.DumpWeightmapDiff"),
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:5401
Scope (from outer to inner):
file
function void ALandscape::OnDirtyHeightmap
Source code excerpt:
void ALandscape::OnDirtyHeightmap(FTextureToComponentHelper const& MapHelper, UTexture2D const* InHeightmap, FColor const* InOldData, FColor const* InNewData, int32 InMipLevel)
{
int32 DumpHeightmapDiff = CVarLandscapeDumpHeightmapDiff.GetValueOnGameThread();
const bool bDumpDiff = (DumpHeightmapDiff > 0);
const bool bDumpDiffAllMips = (DumpHeightmapDiff > 1);
const bool bDumpDiffDetails = CVarLandscapeDumpDiffDetails.GetValueOnGameThread();
const bool bTrackDirty = CVarLandscapeTrackDirty.GetValueOnGameThread() != 0;
ULandscapeSubsystem* LandscapeSubsystem = GetWorld()->GetSubsystem<ULandscapeSubsystem>();
check(LandscapeSubsystem != nullptr);