landscape.ShowDirty
landscape.ShowDirty
#Overview
name: landscape.ShowDirty
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This will highlight the data that has changed during the layer blend phase.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.ShowDirty is to highlight data that has changed during the landscape layer blending phase in Unreal Engine 5. This setting is primarily used for debugging and development purposes within the Landscape system.
-
The Unreal Engine subsystem that relies on this setting variable is the Landscape system, specifically the rendering and editing components.
-
The value of this variable is set through a console variable (CVar) named CVarLandscapeShowDirty. It is initialized with a default value of 0 in the LandscapeEditLayers.cpp file.
-
This variable interacts closely with GLandscapeDirtyMaterial, which is likely a material used to visually represent the “dirty” or changed areas of the landscape.
-
Developers must be aware that this variable is primarily used in editor and debug scenarios. It’s not intended for use in final, shipped games.
-
Best practices when using this variable include:
- Use it only during development and debugging phases.
- Be aware that enabling this feature may have performance implications, as it adds additional rendering passes.
- Disable it before final builds or shipping the game.
Regarding the associated variable CVarLandscapeShowDirty:
- CVarLandscapeShowDirty is the actual console variable that controls the landscape.ShowDirty setting.
- It is defined as a TAutoConsoleVariable
, which means it’s an integer value that can be changed at runtime through the console. - This variable is used in various parts of the Landscape rendering code to determine whether to show the “dirty” areas.
- It’s checked in both the render thread (GetValueOnRenderThread()) and potentially other threads (GetValueOnAnyThread()), indicating that its value can affect both rendering and potentially other landscape-related operations.
- When enabled (value > 0), it triggers additional rendering passes to highlight changed areas in the landscape.
- Developers should use this variable in conjunction with GLandscapeDirtyMaterial to visualize changes in the landscape during editing or debugging sessions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:161
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarLandscapeShowDirty(
TEXT("landscape.ShowDirty"),
0,
TEXT("This will highlight the data that has changed during the layer blend phase."));
TAutoConsoleVariable<int32> CVarLandscapeTrackDirty(
TEXT("landscape.TrackDirty"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeShowDirty
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:160
Scope: file
Source code excerpt:
TEXT("Threshold to avoid imprecision issues on certain GPUs when detecting when a weightmap changes, i.e. only a difference > than this threshold (N over each 8-bits uint weightmap channel)."));
TAutoConsoleVariable<int32> CVarLandscapeShowDirty(
TEXT("landscape.ShowDirty"),
0,
TEXT("This will highlight the data that has changed during the layer blend phase."));
TAutoConsoleVariable<int32> CVarLandscapeTrackDirty(
TEXT("landscape.TrackDirty"),
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:199
Scope: file
Source code excerpt:
#if WITH_EDITOR
extern TAutoConsoleVariable<int32> CVarLandscapeShowDirty;
#endif
extern RENDERER_API TAutoConsoleVariable<float> CVarStaticMeshLODDistanceScale;
extern int32 GGrassMapUseRuntimeGeneration;
extern int32 GGrassMapAlwaysBuildRuntimeGenerationResources;
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:2053
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FLandscapeComponentSceneProxy::GetViewRelevance
Source code excerpt:
}
if (CVarLandscapeShowDirty.GetValueOnRenderThread() && GLandscapeDirtyMaterial)
{
Result.bDynamicRelevance = true;
ToolRelevance |= GLandscapeDirtyMaterial->GetRelevance_Concurrent(FeatureLevel);
}
ToolRelevance.SetPrimitiveViewRelevance(Result);
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:2087
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FLandscapeComponentSceneProxy::GetViewRelevance
Source code excerpt:
(IsSelected() && !GLandscapeEditModeActive) ||
(GLandscapeViewMode != ELandscapeViewMode::Normal) ||
(CVarLandscapeShowDirty.GetValueOnAnyThread() && GLandscapeDirtyMaterial) ||
(GetViewLodOverride(*View, LandscapeKey) >= 0)
#else
IsSelected() ||
(View->CustomRenderPass && GetViewLodOverride(*View, LandscapeKey) >= 0)
#endif
)
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:2769
Scope: file
Source code excerpt:
}
#if WITH_EDITOR
else if (CVarLandscapeShowDirty.GetValueOnRenderThread() && GLandscapeDirtyMaterial)
{
Mesh.bCanApplyViewModeOverrides = false;
Collector.AddMesh(ViewIndex, Mesh);
NumPasses++;
NumTriangles += Mesh.GetNumPrimitives();
NumDrawCalls += Mesh.Elements.Num();