landscape.BrushOptim
landscape.BrushOptim
#Overview
name: landscape.BrushOptim
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This will enable landscape layers optim.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.BrushOptim is to enable landscape layers optimization in Unreal Engine 5. This setting variable is specifically designed for the landscape system, which is a part of the engine’s terrain rendering and editing functionality.
This setting variable is primarily used within the Landscape module of Unreal Engine 5. Based on the callsites provided, it’s clear that this variable is utilized in the LandscapeEditLayers.cpp file, which is responsible for handling landscape layer editing operations.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning the optimization is disabled by default. Developers can change this value at runtime using console commands or through project settings.
The associated variable CVarLandscapeLayerBrushOptim directly interacts with landscape.BrushOptim. They share the same value and purpose, with CVarLandscapeLayerBrushOptim being the C++ representation of the console variable.
Developers must be aware that when this variable is set to 1, it enables an optimization for landscape layer brush operations. Specifically, it allows skipping certain brush operations during heightmap and weightmap updates when only editing operations are being performed.
Best practices when using this variable include:
- Enable it (set to 1) when performance optimization for landscape editing is needed, especially for large landscapes or complex editing operations.
- Be cautious when enabling this optimization, as it may affect the precision or behavior of certain landscape editing operations.
- Test thoroughly with this optimization both enabled and disabled to ensure it doesn’t negatively impact your specific use case.
- Consider exposing this setting in your project’s settings UI for easy toggling during development and testing.
Regarding the associated variable CVarLandscapeLayerBrushOptim:
The purpose of CVarLandscapeLayerBrushOptim is to provide programmatic access to the landscape.BrushOptim setting within C++ code. It allows developers to read and potentially modify the optimization setting at runtime.
This variable is used in the Landscape module, specifically in functions responsible for regenerating landscape layer heightmaps and weightmaps.
The value of CVarLandscapeLayerBrushOptim is set through the CVar system, mirroring the value of landscape.BrushOptim.
It interacts directly with the landscape editing systems, influencing whether certain brush operations are skipped during heightmap and weightmap updates.
Developers should be aware that this variable is queried during landscape editing operations, and its value can significantly affect performance and behavior of these operations.
Best practices for using CVarLandscapeLayerBrushOptim include:
- Use GetValueOnAnyThread() to safely read its value from any thread.
- Consider the implications of changing this value at runtime, as it may affect ongoing landscape editing operations.
- Use this variable in conjunction with other landscape-related settings and optimizations for best results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:126
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLandscapeLayerBrushOptim(
TEXT("landscape.BrushOptim"),
0,
TEXT("This will enable landscape layers optim."));
static TAutoConsoleVariable<int32> CVarLandscapeDumpHeightmapDiff(
TEXT("landscape.DumpHeightmapDiff"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeLayerBrushOptim
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:125
Scope: file
Source code excerpt:
TEXT("This will enable landscape layers optim."));
static TAutoConsoleVariable<int32> CVarLandscapeLayerBrushOptim(
TEXT("landscape.BrushOptim"),
0,
TEXT("This will enable landscape layers optim."));
static TAutoConsoleVariable<int32> CVarLandscapeDumpHeightmapDiff(
TEXT("landscape.DumpHeightmapDiff"),
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:5080
Scope (from outer to inner):
file
function int32 ALandscape::RegenerateLayersHeightmaps
Source code excerpt:
const int32 HeightmapUpdateModes = LayerContentUpdateModes & AllHeightmapUpdateModes;
const bool bForceRender = CVarForceLayersUpdate.GetValueOnAnyThread() != 0;
const bool bSkipBrush = CVarLandscapeLayerBrushOptim.GetValueOnAnyThread() == 1 && ((HeightmapUpdateModes & AllHeightmapUpdateModes) == ELandscapeLayerUpdateMode::Update_Heightmap_Editing);
if ((HeightmapUpdateModes == 0 && !bForceRender) || Info == nullptr)
{
return 0;
}
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:7574
Scope (from outer to inner):
file
function int32 ALandscape::RegenerateLayersWeightmaps
Source code excerpt:
const int32 AllWeightmapUpdateModes = (ELandscapeLayerUpdateMode::Update_Weightmap_All | ELandscapeLayerUpdateMode::Update_Weightmap_Editing | ELandscapeLayerUpdateMode::Update_Weightmap_Editing_NoCollision);
const int32 WeightmapUpdateModes = LayerContentUpdateModes & AllWeightmapUpdateModes;
const bool bSkipBrush = CVarLandscapeLayerBrushOptim.GetValueOnAnyThread() == 1 && ((WeightmapUpdateModes & AllWeightmapUpdateModes) == ELandscapeLayerUpdateMode::Update_Weightmap_Editing);
const bool bForceRender = CVarForceLayersUpdate.GetValueOnAnyThread() != 0;
ULandscapeInfo* Info = GetLandscapeInfo();
if (WeightmapUpdateModes == 0 && !bForceRender)
{