UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeGrassMapsBuilder.cpp File Reference

Namespaces

namespace  UE
 
namespace  UE::Landscape
 

Macros

#define LOCTEXT_NAMESPACE   "Landscape"
 
#define GRASS_DEBUG_LOG(...)   UE_LOG(LogGrass, Verbose, __VA_ARGS__)
 
#define DEBUG_TRANSITION(StateRef, StageBefore, StageAfter)
 

Functions

 DECLARE_CYCLE_STAT (TEXT("Update Component GrassMap "), STAT_UpdateComponentGrassMaps, STATGROUP_Foliage)
 
 DECLARE_CYCLE_STAT (TEXT("Prioritize Pending GrassMaps"), STAT_PrioritizePendingGrassMaps, STATGROUP_Foliage)
 
 DECLARE_CYCLE_STAT (TEXT("Render GrassMap"), STAT_RenderGrassMap, STATGROUP_Foliage)
 
 DECLARE_CYCLE_STAT (TEXT("Populate GrassMap"), STAT_PopulateGrassMap, STATGROUP_Foliage)
 
 DECLARE_CYCLE_STAT (TEXT("Remove Grass Instances"), STAT_RemoveGrassInstances, STATGROUP_Foliage)
 
uint32 UE::Landscape::ComputeGrassMapGenerationHash (const ULandscapeComponent *Component, UMaterialInterface *Material)
 
uint32 UE::Landscape::ComputeGrassInstanceGenerationHash (uint32 GrassMapGenerationHash, const TArray< TObjectPtr< ULandscapeGrassType > > &GrassTypes)
 
LANDSCAPE_API bool UE::Landscape::CanRenderGrassMap (ULandscapeComponent *Component)
 
LANDSCAPE_API bool UE::Landscape::IsRuntimeGrassMapGenerationSupported ()
 
void UE::Landscape::SubmitGPUCommands (bool bBlockUntilRTComplete, bool bBlockRTUntilGPUComplete)
 

Variables

int32 GGrassEnable
 
float GGrassCullDistanceScale
 
int32 GGrassMapUseRuntimeGeneration = 0
 
FAutoConsoleVariableRef CVarGrassMapUseRuntimeGeneration (TEXT("grass.GrassMap.UseRuntimeGeneration"), GGrassMapUseRuntimeGeneration, TEXT("Enable runtime grass map generation to save disk space and runtime memory. When enabled the grass density maps are not serialized and are built on the fly at runtime."))
 
int32 GGrassMapEvictAll = 0
 
FAutoConsoleVariableRef CVarGrassMapEvictAll (TEXT("grass.GrassMap.EvictAll"), GGrassMapEvictAll, TEXT("Remove all grass maps. In editor, or if runtime generation is enabled, the grass maps will repopulate automatically."))
 
FString GGrassMapRenderEveryFrame
 
FAutoConsoleVariableRef CVarGrassMapRenderEveryFrame (TEXT("grass.GrassMap.RenderEveryFrame"), GGrassMapRenderEveryFrame, TEXT("Forces re-rendering the grassmap for the landscape component(s) on any actors with a name containing the given string."))
 
int32 GGrassMapRenderEveryFrameDelay = 0
 
FAutoConsoleVariableRef CVarGrassMapRenderEveryFrameDelay (TEXT("grass.GrassMap.RenderEveryFrameDelay"), GGrassMapRenderEveryFrameDelay, TEXT("When using grass.GrassMap.RenderEveryFrame, delays this many frames in between renders. Default 0."))
 
int32 GGrassMapUseAsyncFetch = 0
 
FAutoConsoleVariableRef CVarGrassMapUseAsyncFetch (TEXT("grass.GrassMap.UseAsyncFetch"), GGrassMapUseAsyncFetch, TEXT("Enable async fetch tasks to readback the runtime grass maps from the GPU. When disabled, it the fetch is performed on the game thread, when enabled it uses an async task instead."))
 
int32 GGrassMapAlwaysBuildRuntimeGenerationResources = 0
 

Macro Definition Documentation

◆ DEBUG_TRANSITION

#define DEBUG_TRANSITION (   StateRef,
  StageBefore,
  StageAfter 
)
Value:
GRASS_DEBUG_LOG(TEXT("%s %s -> %s (after %d ticks) Pend:%d Strm:%d Rend:%d Fetch:%d Pop:%d NR:%d Total:%d"), \
StateRef.Component ? *StateRef.Component->GetName() : TEXT("<REMOVED>"), \
StateRef.TickCount, \
PendingCount, \
StreamingCount, \
RenderingCount, \
AsyncFetchCount, \
PopulatedCount, \
NotReadyCount, \
ComponentStates.Num())
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define GRASS_DEBUG_LOG(...)
Definition LandscapeGrassMapsBuilder.cpp:24
@ Num
Definition MetalRHIPrivate.h:234

◆ GRASS_DEBUG_LOG

#define GRASS_DEBUG_LOG (   ...)    UE_LOG(LogGrass, Verbose, __VA_ARGS__)

◆ LOCTEXT_NAMESPACE

#define LOCTEXT_NAMESPACE   "Landscape"

Function Documentation

◆ DECLARE_CYCLE_STAT() [1/5]

DECLARE_CYCLE_STAT ( TEXT("Populate GrassMap" ,
STAT_PopulateGrassMap  ,
STATGROUP_Foliage   
)

◆ DECLARE_CYCLE_STAT() [2/5]

DECLARE_CYCLE_STAT ( TEXT("Prioritize Pending GrassMaps" ,
STAT_PrioritizePendingGrassMaps  ,
STATGROUP_Foliage   
)

◆ DECLARE_CYCLE_STAT() [3/5]

DECLARE_CYCLE_STAT ( TEXT("Remove Grass Instances" ,
STAT_RemoveGrassInstances  ,
STATGROUP_Foliage   
)

◆ DECLARE_CYCLE_STAT() [4/5]

DECLARE_CYCLE_STAT ( TEXT("Render GrassMap" ,
STAT_RenderGrassMap  ,
STATGROUP_Foliage   
)

◆ DECLARE_CYCLE_STAT() [5/5]

DECLARE_CYCLE_STAT ( TEXT("Update Component GrassMap ")  ,
STAT_UpdateComponentGrassMaps  ,
STATGROUP_Foliage   
)

Variable Documentation

◆ CVarGrassMapEvictAll

FAutoConsoleVariableRef CVarGrassMapEvictAll(TEXT("grass.GrassMap.EvictAll"), GGrassMapEvictAll, TEXT("Remove all grass maps. In editor, or if runtime generation is enabled, the grass maps will repopulate automatically.")) ( TEXT("grass.GrassMap.EvictAll")  ,
GGrassMapEvictAll  ,
TEXT("Remove all grass maps. In editor, or if runtime generation is enabled, the grass maps will repopulate automatically."  
)

◆ CVarGrassMapRenderEveryFrame

FAutoConsoleVariableRef CVarGrassMapRenderEveryFrame(TEXT("grass.GrassMap.RenderEveryFrame"), GGrassMapRenderEveryFrame, TEXT("Forces re-rendering the grassmap for the landscape component(s) on any actors with a name containing the given string.")) ( TEXT("grass.GrassMap.RenderEveryFrame")  ,
GGrassMapRenderEveryFrame  ,
TEXT("Forces re-rendering the grassmap for the landscape component(s) on any actors with a name containing the given string."  
)

◆ CVarGrassMapRenderEveryFrameDelay

FAutoConsoleVariableRef CVarGrassMapRenderEveryFrameDelay(TEXT("grass.GrassMap.RenderEveryFrameDelay"), GGrassMapRenderEveryFrameDelay, TEXT("When using grass.GrassMap.RenderEveryFrame, delays this many frames in between renders. Default 0.")) ( TEXT("grass.GrassMap.RenderEveryFrameDelay")  ,
GGrassMapRenderEveryFrameDelay  ,
TEXT("When using grass.GrassMap.RenderEveryFrame, delays this many frames in between renders. Default 0.")   
)

◆ CVarGrassMapUseAsyncFetch

FAutoConsoleVariableRef CVarGrassMapUseAsyncFetch(TEXT("grass.GrassMap.UseAsyncFetch"), GGrassMapUseAsyncFetch, TEXT("Enable async fetch tasks to readback the runtime grass maps from the GPU. When disabled, it the fetch is performed on the game thread, when enabled it uses an async task instead.")) ( TEXT("grass.GrassMap.UseAsyncFetch")  ,
GGrassMapUseAsyncFetch  ,
TEXT("Enable async fetch tasks to readback the runtime grass maps from the GPU. When disabled, it the fetch is performed on the game thread, when enabled it uses an async task instead."  
)

◆ CVarGrassMapUseRuntimeGeneration

FAutoConsoleVariableRef CVarGrassMapUseRuntimeGeneration(TEXT("grass.GrassMap.UseRuntimeGeneration"), GGrassMapUseRuntimeGeneration, TEXT("Enable runtime grass map generation to save disk space and runtime memory. When enabled the grass density maps are not serialized and are built on the fly at runtime.")) ( TEXT("grass.GrassMap.UseRuntimeGeneration")  ,
GGrassMapUseRuntimeGeneration  ,
TEXT("Enable runtime grass map generation to save disk space and runtime memory. When enabled the grass density maps are not serialized and are built on the fly at runtime."  
)

◆ GGrassCullDistanceScale

float GGrassCullDistanceScale
extern

◆ GGrassEnable

int32 GGrassEnable
extern

◆ GGrassMapAlwaysBuildRuntimeGenerationResources

int32 GGrassMapAlwaysBuildRuntimeGenerationResources = 0

◆ GGrassMapEvictAll

int32 GGrassMapEvictAll = 0

◆ GGrassMapRenderEveryFrame

FString GGrassMapRenderEveryFrame

◆ GGrassMapRenderEveryFrameDelay

int32 GGrassMapRenderEveryFrameDelay = 0

◆ GGrassMapUseAsyncFetch

int32 GGrassMapUseAsyncFetch = 0

◆ GGrassMapUseRuntimeGeneration

int32 GGrassMapUseRuntimeGeneration = 0