UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
InstancedStaticMesh.cpp File Reference
#include "Engine/InstancedStaticMesh.h"
#include "Elements/SMInstance/SMInstanceElementId.h"
#include "Engine/Level.h"
#include "Engine/OverlapResult.h"
#include "AI/NavigationSystemBase.h"
#include "Engine/MapBuildDataRegistry.h"
#include "StaticLightingBuildContext.h"
#include "Components/LightComponent.h"
#include "EngineLogs.h"
#include "Logging/MessageLog.h"
#include "Materials/Material.h"
#include "UnrealEngine.h"
#include "AI/NavigationSystemHelpers.h"
#include "AI/Navigation/NavCollisionBase.h"
#include "AI/Navigation/NavigationRelevantData.h"
#include "MeshDrawShaderBindings.h"
#include "Misc/UObjectToken.h"
#include "Misc/DelayedAutoRegister.h"
#include "PhysicsEngine/BodySetup.h"
#include "GameFramework/WorldSettings.h"
#include "ComponentRecreateRenderStateContext.h"
#include "UObject/MobileObjectVersion.h"
#include "EngineStats.h"
#include "Interfaces/ITargetPlatform.h"
#include "MaterialDomain.h"
#include "Materials/MaterialRenderProxy.h"
#include "MeshMaterialShader.h"
#include "ProfilingDebugging/LoadTimeTracker.h"
#include "RenderUtils.h"
#include "StaticMeshComponentLODInfo.h"
#include "NaniteSceneProxy.h"
#include "MaterialCachedData.h"
#include "Collision.h"
#include "CollisionDebugDrawingPublic.h"
#include "DataDrivenShaderPlatformInfo.h"
#include "Chaos/PhysicsObjectInterface.h"
#include "PhysicsProxy/SingleParticlePhysicsProxy.h"
#include "Elements/Framework/EngineElementsLibrary.h"
#include "Elements/Interfaces/TypedElementWorldInterface.h"
#include "UObject/UObjectIterator.h"
#include "UObject/ObjectSaveContext.h"
#include "GenericPlatform/ICursor.h"
#include "NaniteVertexFactory.h"
#include "InstancedStaticMeshSceneProxyDesc.h"
#include "InstancedStaticMesh/ISMInstanceDataManager.h"
#include "InstancedStaticMeshComponentHelper.h"
#include "Templates/Greater.h"
#include "UObject/FortniteMainBranchObjectVersion.h"
#include "UObject/EditorObjectVersion.h"
#include "InstancedStaticMesh/ISMInstanceUpdateChangeSet.h"

Classes

class  FISMExecHelper
 
class  FDummyFloatBuffer
 
class  FInstancedStaticMeshVFUniformsCache
 
struct  FInstancedStaticMeshInstanceData_DEPRECATED
 

Functions

 IMPLEMENT_TYPE_LAYOUT (FInstancedStaticMeshVertexFactoryShaderParameters)
 
 CSV_DEFINE_CATEGORY_MODULE (ENGINE_API, InstancedStaticMeshComponent, true)
 
 IMPLEMENT_HIT_PROXY (HInstancedStaticMeshInstance, HHitProxy)
 
 IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT (FInstancedStaticMeshVertexFactoryUniformShaderParameters, "InstanceVF")
 
 IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT (FInstancedStaticMeshVFLooseUniformShaderParameters, "InstancedVFLooseParameters")
 
 IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE (FInstancedStaticMeshVertexFactory, SF_Vertex, FInstancedStaticMeshVertexFactoryShaderParameters)
 
 IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE (FInstancedStaticMeshVertexFactory, SF_Pixel, FInstancedStaticMeshVertexFactoryShaderParameters)
 
 IMPLEMENT_VERTEX_FACTORY_TYPE (FInstancedStaticMeshVertexFactory,"/Engine/Private/LocalVertexFactory.ush", EVertexFactoryFlags::UsedWithMaterials|EVertexFactoryFlags::SupportsStaticLighting|EVertexFactoryFlags::SupportsDynamicLighting|EVertexFactoryFlags::SupportsPrecisePrevWorldPos|EVertexFactoryFlags::SupportsCachingMeshDrawCommands|EVertexFactoryFlags::SupportsRayTracing|EVertexFactoryFlags::SupportsRayTracingDynamicGeometry|EVertexFactoryFlags::SupportsLightmapBaking|EVertexFactoryFlags::SupportsPrimitiveIdStream|EVertexFactoryFlags::DoesNotSupportNullPixelShader|EVertexFactoryFlags::SupportsManualVertexFetch|EVertexFactoryFlags::SupportsPSOPrecaching|EVertexFactoryFlags::SupportsLumenMeshCards)
 

Variables

const int32 InstancedStaticMeshMaxTexCoord = 8
 
TAutoConsoleVariable< int32CVarGpuLodSelection (TEXT("r.InstancedStaticMeshes.GpuLod"), 1, TEXT("Whether to enable GPU LOD selection on InstancedStaticMesh."), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;}), ECVF_RenderThreadSafe)
 
TAutoConsoleVariable< int32CVarMinLOD (TEXT("foliage.MinLOD"), -1, TEXT("Used to discard the top LODs for performance evaluation. -1: Disable all effects of this cvar."), ECVF_Scalability|ECVF_Default)
 
FAutoConsoleVariableSink CVarRayTracingInstancesEvaluateWPOSink (FConsoleCommandDelegate::CreateLambda([]() { static int32 CachedValue=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread();int32 Value=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread();if(CachedValue !=Value) { CachedValue=Value;FFunctionGraphTask::CreateAndDispatchWhenReady([]() { FlushRenderingCommands();FGlobalComponentReregisterContext ReregisterContext;}, TStatId(), nullptr, ENamedThreads::GameThread);} }))
 
FAutoConsoleVariableRef CVarISMConservativeBoundsThreshold (TEXT("r.InstancedStaticMeshes.ConservativeBounds.Threshold"), GConservativeBoundsThreshold, TEXT("Number of instances in an ISM before we start using conservative bounds. Set to -1 to disable conservative bounds."))
 
TGlobalResource< FDummyFloatBufferGDummyFloatBuffer
 
float DebugLineLifetime
 

Function Documentation

◆ CSV_DEFINE_CATEGORY_MODULE()

CSV_DEFINE_CATEGORY_MODULE ( ENGINE_API  ,
InstancedStaticMeshComponent  ,
true   
)

◆ IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT() [1/2]

IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT ( FInstancedStaticMeshVertexFactoryUniformShaderParameters  ,
"InstanceVF"   
)

◆ IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT() [2/2]

IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT ( FInstancedStaticMeshVFLooseUniformShaderParameters  ,
"InstancedVFLooseParameters"   
)

◆ IMPLEMENT_HIT_PROXY()

IMPLEMENT_HIT_PROXY ( HInstancedStaticMeshInstance  ,
HHitProxy   
)

◆ IMPLEMENT_TYPE_LAYOUT()

◆ IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE() [1/2]

IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE ( FInstancedStaticMeshVertexFactory  ,
SF_Pixel  ,
FInstancedStaticMeshVertexFactoryShaderParameters   
)

◆ IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE() [2/2]

IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE ( FInstancedStaticMeshVertexFactory  ,
SF_Vertex  ,
FInstancedStaticMeshVertexFactoryShaderParameters   
)

◆ IMPLEMENT_VERTEX_FACTORY_TYPE()

Variable Documentation

◆ CVarGpuLodSelection

TAutoConsoleVariable< int32 > CVarGpuLodSelection(TEXT("r.InstancedStaticMeshes.GpuLod"), 1, TEXT("Whether to enable GPU LOD selection on InstancedStaticMesh."), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;}), ECVF_RenderThreadSafe) ( TEXT("r.InstancedStaticMeshes.GpuLod")  ,
,
TEXT("Whether to enable GPU LOD selection on InstancedStaticMesh." ,
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;})  ,
ECVF_RenderThreadSafe   
)

◆ CVarISMConservativeBoundsThreshold

FAutoConsoleVariableRef CVarISMConservativeBoundsThreshold(TEXT("r.InstancedStaticMeshes.ConservativeBounds.Threshold"), GConservativeBoundsThreshold, TEXT("Number of instances in an ISM before we start using conservative bounds. Set to -1 to disable conservative bounds.")) ( TEXT("r.InstancedStaticMeshes.ConservativeBounds.Threshold")  ,
GConservativeBoundsThreshold  ,
TEXT("Number of instances in an ISM before we start using conservative bounds. Set to -1 to disable conservative bounds."  
)

◆ CVarMinLOD

TAutoConsoleVariable< int32 > CVarMinLOD(TEXT("foliage.MinLOD"), -1, TEXT("Used to discard the top LODs for performance evaluation. -1: Disable all effects of this cvar."), ECVF_Scalability|ECVF_Default) ( TEXT("foliage.MinLOD")  ,
1,
TEXT("Used to discard the top LODs for performance evaluation. -1: Disable all effects of this cvar." ,
ECVF_Scalability ECVF_Default 
)

◆ CVarRayTracingInstancesEvaluateWPOSink

FAutoConsoleVariableSink CVarRayTracingInstancesEvaluateWPOSink(FConsoleCommandDelegate::CreateLambda([]() { static int32 CachedValue=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread(); int32 Value=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread(); if(CachedValue !=Value) { CachedValue=Value; FFunctionGraphTask::CreateAndDispatchWhenReady([]() { FlushRenderingCommands(); FGlobalComponentReregisterContext ReregisterContext; }, TStatId(), nullptr, ENamedThreads::GameThread); } })) ( FConsoleCommandDelegate::CreateLambda([]() { static int32 CachedValue=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread(); int32 Value=CVarRayTracingInstancesEvaluateWPO.GetValueOnGameThread(); if(CachedValue !=Value) { CachedValue=Value; FFunctionGraphTask::CreateAndDispatchWhenReady([]() { FlushRenderingCommands(); FGlobalComponentReregisterContext ReregisterContext; }, TStatId(), nullptr, ENamedThreads::GameThread); } })  )

◆ DebugLineLifetime

float DebugLineLifetime
extern

◆ GDummyFloatBuffer

TGlobalResource<FDummyFloatBuffer> GDummyFloatBuffer

◆ InstancedStaticMeshMaxTexCoord

const int32 InstancedStaticMeshMaxTexCoord = 8