landscape.DirtyHeightmapNormalThreshold
landscape.DirtyHeightmapNormalThreshold
#Overview
name: landscape.DirtyHeightmapNormalThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Threshold to avoid imprecision issues on certain GPUs when detecting when a heightmap normal changes, i.e. only a normal channel difference > than this threshold (N over each 8-bits uint B & A channels independently) will be detected as a change.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.DirtyHeightmapNormalThreshold is to set a threshold for detecting changes in landscape heightmap normals. This setting is part of the Landscape system in Unreal Engine 5, which is responsible for rendering and managing large-scale terrain in games.
This setting variable is primarily used in the Landscape module of Unreal Engine 5, specifically within the landscape editing and rendering systems.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s defined in the LandscapeEditLayers.cpp file.
The associated variable CVarLandscapeDirtyHeightmapNormalThreshold interacts directly with landscape.DirtyHeightmapNormalThreshold. They share the same value and purpose.
Developers must be aware that this variable is used to mitigate precision issues on certain GPUs when detecting changes in heightmap normals. It sets a threshold for what is considered a significant change in the normal map of a landscape.
Best practices when using this variable include:
- Understanding the impact on performance and visual quality when adjusting this value.
- Testing on various GPU hardware to ensure optimal settings across different platforms.
- Balancing the threshold to avoid unnecessary updates while maintaining visual fidelity.
Regarding the associated variable CVarLandscapeDirtyHeightmapNormalThreshold:
The purpose of CVarLandscapeDirtyHeightmapNormalThreshold is to provide programmatic access to the landscape.DirtyHeightmapNormalThreshold setting within the C++ code of Unreal Engine.
This variable is used in the Landscape module, specifically in the ALandscape class’s HasTextureDataChanged function.
The value of this variable is set when the landscape.DirtyHeightmapNormalThreshold console variable is set, and it can be accessed in code using the GetValueOnGameThread() method.
It interacts directly with the landscape.DirtyHeightmapNormalThreshold setting and is used in conjunction with CVarLandscapeDirtyHeightmapHeightThreshold for determining if landscape texture data has changed.
Developers should be aware that this variable is used in performance-critical sections of the landscape rendering code, and changes to its value can affect both performance and visual quality.
Best practices for using this variable include:
- Using it in conjunction with profiling tools to optimize landscape rendering performance.
- Carefully considering the balance between update frequency and visual quality when adjusting its value.
- Testing any changes across a range of hardware configurations to ensure consistent behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:151
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarLandscapeDirtyHeightmapNormalThreshold(
TEXT("landscape.DirtyHeightmapNormalThreshold"),
0,
TEXT("Threshold to avoid imprecision issues on certain GPUs when detecting when a heightmap normal changes, i.e. only a normal channel difference > than this threshold (N over each 8-bits uint B & A channels independently) will be detected as a change."));
TAutoConsoleVariable<int32> CVarLandscapeDirtyWeightmapThreshold(
TEXT("landscape.DirtyWeightmapThreshold"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeDirtyHeightmapNormalThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:150
Scope: file
Source code excerpt:
TEXT("Threshold to avoid imprecision issues on certain GPUs when detecting when a heightmap height changes, i.e. only a height difference > than this threshold (N over 16-bits uint height) will be detected as a change."));
TAutoConsoleVariable<int32> CVarLandscapeDirtyHeightmapNormalThreshold(
TEXT("landscape.DirtyHeightmapNormalThreshold"),
0,
TEXT("Threshold to avoid imprecision issues on certain GPUs when detecting when a heightmap normal changes, i.e. only a normal channel difference > than this threshold (N over each 8-bits uint B & A channels independently) will be detected as a change."));
TAutoConsoleVariable<int32> CVarLandscapeDirtyWeightmapThreshold(
TEXT("landscape.DirtyWeightmapThreshold"),
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:5545
Scope (from outer to inner):
file
function bool ALandscape::HasTextureDataChanged
Source code excerpt:
{
int32 DirtyHeightmapHeightThreshold = CVarLandscapeDirtyHeightmapHeightThreshold.GetValueOnGameThread();
int32 DirtyHeightmapNormalThreshold = CVarLandscapeDirtyHeightmapNormalThreshold.GetValueOnGameThread();
if (DirtyHeightmapHeightThreshold > 0 || DirtyHeightmapNormalThreshold > 0)
{
TRACE_CPUPROFILER_EVENT_SCOPE(DeepCompareHeightmap);
for (int32 Index = 0; Index < TextureSize; ++Index)
{
const FColor& OldColor = InOldData[Index];