foliage.OverestimateLOD
foliage.OverestimateLOD
#Overview
name: foliage.OverestimateLOD
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If greater than zero and dithered LOD is not used, then we use an overestimate of LOD instead of an underestimate.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of foliage.OverestimateLOD is to control the Level of Detail (LOD) selection for hierarchical instanced static meshes, particularly in the context of foliage rendering.
This setting variable is primarily used in the Engine module, specifically within the HierarchicalInstancedStaticMesh component. It affects the rendering system, particularly the LOD selection for instanced meshes like foliage.
The value of this variable is set through a console variable (CVarOverestimateLOD) in the Unreal Engine. It’s initialized with a default value of 0, but can be changed at runtime through console commands or programmatically.
The associated variable CVarOverestimateLOD directly interacts with foliage.OverestimateLOD. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable only takes effect when dithered LOD is not in use. When the value is greater than zero and dithered LOD is not used, the system will use an overestimate of LOD instead of an underestimate. This can affect the visual quality and performance of foliage rendering.
Best practices when using this variable include:
- Use it in conjunction with other foliage-related settings for optimal performance and visual quality.
- Test thoroughly with different values to find the best balance between performance and visual fidelity for your specific use case.
- Be mindful of its interaction with dithered LOD settings.
- Consider the impact on performance, especially in scenes with dense foliage.
Regarding the associated variable CVarOverestimateLOD:
- Its purpose is to provide programmatic access to the foliage.OverestimateLOD setting within the C++ code.
- It’s used in the Engine module, specifically in the HierarchicalInstancedStaticMesh component.
- Its value is set when the console variable is initialized and can be changed at runtime.
- It directly interacts with foliage.OverestimateLOD, sharing the same value.
- Developers should be aware that this variable is accessed on the render thread, which has implications for thread safety and performance.
- Best practices include using the appropriate getter method (GetValueOnRenderThread()) when accessing this variable to ensure thread-safe operations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:71
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarOverestimateLOD(
TEXT("foliage.OverestimateLOD"),
0,
TEXT("If greater than zero and dithered LOD is not used, then we use an overestimate of LOD instead of an underestimate."));
static TAutoConsoleVariable<int32> CVarMaxTrianglesToRender(
TEXT("foliage.MaxTrianglesToRender"),
100000000,
#Associated Variable and Callsites
This variable is associated with another variable named CVarOverestimateLOD
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:70
Scope: file
Source code excerpt:
TEXT("If greater than zero, dithered LOD is used, otherwise popping LOD is used."));
static TAutoConsoleVariable<int32> CVarOverestimateLOD(
TEXT("foliage.OverestimateLOD"),
0,
TEXT("If greater than zero and dithered LOD is not used, then we use an overestimate of LOD instead of an underestimate."));
static TAutoConsoleVariable<int32> CVarMaxTrianglesToRender(
TEXT("foliage.MaxTrianglesToRender"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:1495
Scope (from outer to inner):
file
function void FHierarchicalStaticMeshSceneProxy::GetDynamicMeshElements
Source code excerpt:
bool bSingleSections = !bMultipleSections;
bool bOverestimate = CVarOverestimateLOD.GetValueOnRenderThread() > 0;
int32 MinVertsToSplitNode = CVarMinVertsToSplitNode.GetValueOnRenderThread();
const FMatrix WorldToLocal = GetLocalToWorld().Inverse();
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)