landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch
landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch
#Overview
name: landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of components being rendered in a single batch when resolving heightmaps. The higher the number, the more heightmaps can be resolved in a single batch (and the higher the GPU memory consumption since more transient textures will be needed in memory at a time)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch is to control the number of landscape components that are rendered in a single batch when resolving heightmaps in Unreal Engine’s landscape system.
This setting variable is primarily used in the Landscape module of Unreal Engine 5, specifically in the landscape editing and rendering subsystem. It’s utilized in the LandscapeEditLayers functionality, which is responsible for managing and rendering landscape layers.
The value of this variable is set as a console variable (CVar) with a default value of 16. It can be modified at runtime through the console or programmatically.
The associated variable CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch directly interacts with this setting. It’s an instance of TAutoConsoleVariable
Developers must be aware that this variable affects GPU memory consumption. As the description in the code suggests, a higher value allows more heightmaps to be resolved in a single batch but increases GPU memory usage due to the need for more transient textures in memory.
Best practices when using this variable include:
- Adjusting the value based on the target hardware capabilities and the specific needs of the project.
- Monitoring GPU memory usage when modifying this value.
- Finding a balance between performance (fewer batches) and memory consumption.
Regarding the associated variable CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch:
Its purpose is to provide a programmatic interface to access and modify the landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch setting.
This variable is used in the Landscape module, specifically in the landscape editing and rendering code.
The value of this variable is set when the console variable is initialized, and it can be accessed using the GetValueOnGameThread() method.
It interacts directly with the landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch setting, providing a way to read and potentially modify its value from C++ code.
Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to access from the render thread.
Best practices for using this variable include:
- Using GetValueOnGameThread() when accessing the value from the game thread.
- Considering thread safety when accessing or modifying the value from different threads.
- Using this variable instead of directly accessing the console variable string for better type safety and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:217
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch(
TEXT("landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch"),
16,
TEXT("Number of components being rendered in a single batch when resolving heightmaps. The higher the number, the more heightmaps can be resolved in a single batch (and the higher the GPU memory consumption since more transient textures will be needed in memory at a time)"),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarLandscapeEditLayersMaxComponentsPerWeightmapResolveBatch(
TEXT("landscape.EditLayersLocalMerge.MaxComponentsPerWeightmapResolveBatch"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:216
Scope: file
Source code excerpt:
FConsoleVariableDelegate::CreateStatic(OnLandscapeEditLayersLocalMergeChanged));
TAutoConsoleVariable<int32> CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch(
TEXT("landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch"),
16,
TEXT("Number of components being rendered in a single batch when resolving heightmaps. The higher the number, the more heightmaps can be resolved in a single batch (and the higher the GPU memory consumption since more transient textures will be needed in memory at a time)"),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarLandscapeEditLayersMaxComponentsPerWeightmapResolveBatch(
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEditLayers.cpp:4662
Scope (from outer to inner):
file
function void ALandscape::PrepareLayersHeightmapsLocalMergeRenderThreadData
Source code excerpt:
TRACE_CPUPROFILER_EVENT_SCOPE(LandscapeLayers_PrepareHeightmapComponentResolveInfoBatches);
int32 MaxComponentsPerResolveBatch = CVarLandscapeEditLayersMaxComponentsPerHeightmapResolveBatch.GetValueOnGameThread();
// Copy the component infos because TextureToResolveInfos indices need to remain stable at this point :
TArray<FComponentResolveInfo> RemainingComponentToResolveInfos = OutRenderThreadData.ComponentToResolveInfos;
if (!RemainingComponentToResolveInfos.IsEmpty())
{
TBitArray<TInlineAllocator<1>> TempBitArray;