foliage.CullAll
foliage.CullAll
#Overview
name: foliage.CullAll
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If greater than zero, everything is considered culled.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of foliage.CullAll is to control the culling behavior of foliage in Unreal Engine 5. It is primarily used in the rendering system, specifically for hierarchical instanced static meshes, which are commonly used for foliage rendering.
This setting variable is primarily relied upon by the Engine module, specifically within the HierarchicalInstancedStaticMesh component. It is used in the rendering pipeline to determine whether all foliage instances should be considered culled, regardless of their visibility or frustum culling status.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 0 and can be changed at runtime through console commands or programmatically.
The associated variable CVarCullAll directly interacts with foliage.CullAll. They share the same value and purpose, with CVarCullAll being the C++ representation of the console variable.
Developers must be aware that when this variable is set to a value greater than zero, all foliage instances will be considered culled, effectively hiding them from view. This can have a significant impact on performance and visual fidelity, so it should be used cautiously.
Best practices when using this variable include:
- Use it for debugging or performance testing purposes.
- Be cautious when enabling it in production builds, as it will hide all foliage.
- Consider using it in conjunction with other culling methods for more granular control.
- Remember to reset it to 0 when normal foliage rendering is desired.
Regarding the associated variable CVarCullAll:
The purpose of CVarCullAll is to provide a C++ interface for the foliage.CullAll console variable. It allows for programmatic access to the culling control within the engine’s code.
CVarCullAll is used within the Engine module, specifically in the HierarchicalInstancedStaticMesh rendering code. It’s checked during the rendering process to determine if culling should be applied.
The value of CVarCullAll is set through the console variable system and can be accessed on the render thread using the GetValueOnRenderThread() method.
CVarCullAll directly interacts with the foliage.CullAll console variable, serving as its in-code representation.
Developers should be aware that CVarCullAll is thread-safe for reading on the render thread, which is crucial for maintaining proper rendering performance.
Best practices for using CVarCullAll include:
- Access its value using GetValueOnRenderThread() when in render thread code.
- Avoid frequent changes to its value during gameplay, as it can impact performance.
- Use it in conjunction with other rendering optimizations for best results.
- Consider exposing it through a user interface for easier debugging and testing.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:60
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarCullAll(
TEXT("foliage.CullAll"),
0,
TEXT("If greater than zero, everything is considered culled."),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarDitheredLOD(
TEXT("foliage.DitheredLOD"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarCullAll
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:59
Scope: file
Source code excerpt:
TEXT("If greater than zero, no culling occurs based on frustum."));
static TAutoConsoleVariable<int32> CVarCullAll(
TEXT("foliage.CullAll"),
0,
TEXT("If greater than zero, everything is considered culled."),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarDitheredLOD(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:1759
Scope (from outer to inner):
file
function void FHierarchicalStaticMeshSceneProxy::GetDynamicMeshElements
Source code excerpt:
UseMinLOD = FMath::Max(UseMinLOD, CurFirstLODIdx);
if (CVarCullAll.GetValueOnRenderThread() < 1)
{
const bool bHasWPODisplacement = InstanceParams.MaxWPODisplacement != 0.0f;
if (bUseVectorCull)
{
if (bHasWPODisplacement)