UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NaniteResources.cpp File Reference
#include "Rendering/NaniteResources.h"
#include "DataDrivenShaderPlatformInfo.h"
#include "Engine/Engine.h"
#include "EngineLogs.h"
#include "EngineModule.h"
#include "HAL/LowLevelMemStats.h"
#include "Rendering/NaniteStreamingManager.h"
#include "Rendering/RayTracingGeometryManager.h"
#include "Rendering/SkeletalMeshRenderData.h"
#include "Rendering/SkeletalMeshLODModel.h"
#include "Rendering/SkeletalMeshModel.h"
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
#include "EngineUtils.h"
#include "Engine/MapBuildDataRegistry.h"
#include "Engine/InstancedStaticMesh.h"
#include "Engine/SkinnedAssetCommon.h"
#include "SkeletalRenderPublic.h"
#include "Materials/Material.h"
#include "Materials/MaterialRenderProxy.h"
#include "CommonRenderResources.h"
#include "DistanceFieldAtlas.h"
#include "NaniteSceneProxy.h"
#include "NaniteVertexFactory.h"
#include "Rendering/NaniteCoarseMeshStreamingManager.h"
#include "Rendering/NaniteResourcesHelper.h"
#include "Elements/SMInstance/SMInstanceElementData.h"
#include "MaterialCachedData.h"
#include "MaterialDomain.h"
#include "MeshMaterialShader.h"
#include "PrimitiveSceneInfo.h"
#include "SceneInterface.h"
#include "StaticMeshComponentLODInfo.h"
#include "Stats/StatsTrace.h"
#include "SkinningDefinitions.h"
#include "MeshCardBuild.h"
#include "ComponentRecreateRenderStateContext.h"
#include "StaticMeshSceneProxyDesc.h"
#include "InstancedStaticMeshSceneProxyDesc.h"
#include "SkinnedMeshSceneProxyDesc.h"
#include "GPUSkinCacheVisualizationData.h"
#include "VT/MeshPaintVirtualTexture.h"
#include "AnimationRuntime.h"
#include "SkeletalDebugRendering.h"
#include "ShadowMap.h"
#include "UnrealEngine.h"
#include "Engine/World.h"
#include "GameFramework/WorldSettings.h"
#include "MaterialCache/MaterialCacheVirtualTexture.h"
#include "MaterialCache/MaterialCacheVirtualTextureDescriptor.h"

Namespaces

namespace  Nanite
 

Functions

 DEFINE_GPU_STAT (NaniteStreaming)
 
 DEFINE_GPU_STAT (NaniteReadback)
 
 DECLARE_LLM_MEMORY_STAT (TEXT("Nanite"), STAT_NaniteLLM, STATGROUP_LLMFULL)
 
 DECLARE_LLM_MEMORY_STAT (TEXT("Nanite"), STAT_NaniteSummaryLLM, STATGROUP_LLM)
 
 LLM_DEFINE_TAG (Nanite, NAME_None, NAME_None, GET_STATFNAME(STAT_NaniteLLM), GET_STATFNAME(STAT_NaniteSummaryLLM))
 
FAutoConsoleVariableRef CVarNaniteProxyRenderMode (TEXT("r.Nanite.ProxyRenderMode"), GNaniteProxyRenderMode, TEXT(" 2: Disable rendering if Nanite is enabled on a mesh but is unsupported, except for static mesh editor toggle."), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;}), ECVF_Scalability|ECVF_RenderThreadSafe)
 
bool AllowLumenCardGenerationForSkeletalMeshes (EShaderPlatform Platform)
 
ERayTracingMode Nanite::GetRayTracingMode ()
 
bool Nanite::GetSupportsCustomDepthRendering ()
 
FArchiveNanite::operator<< (FArchive &Ar, FPackedHierarchyNode &Node)
 
FArchiveNanite::operator<< (FArchive &Ar, FPageStreamingState &PageStreamingState)
 
FArchiveNanite::operator<< (FArchive &Ar, FPageRangeKey &PageRangeKey)
 
void Nanite::AuditMaterials (const USkinnedMeshComponent *Component, FMaterialAudit &Audit, bool bSetMaterialUsage)
 
void Nanite::AuditMaterials (const UStaticMeshComponent *Component, FMaterialAudit &Audit, bool bSetMaterialUsage)
 
void Nanite::AuditMaterials (const FStaticMeshSceneProxyDesc *ProxyDesc, FMaterialAudit &Audit, bool bSetMaterialUsage)
 
void Nanite::AuditMaterials (const FSkinnedMeshSceneProxyDesc *ProxyDesc, FMaterialAudit &Audit, bool bSetMaterialUsage)
 
bool Nanite::IsSupportedBlendMode (EBlendMode BlendMode)
 
bool Nanite::IsSupportedBlendMode (const FMaterialShaderParameters &In)
 
bool Nanite::IsSupportedBlendMode (const FMaterial &In)
 
bool Nanite::IsSupportedBlendMode (const UMaterialInterface &In)
 
bool Nanite::IsSupportedMaterialDomain (EMaterialDomain Domain)
 
bool Nanite::IsSupportedShadingModel (FMaterialShadingModelField ShadingModelField)
 
bool Nanite::IsMaskingAllowed (UWorld *World, bool bForceNaniteForMasked)
 
EProxyRenderMode Nanite::GetProxyRenderMode ()
 
FMeshDataSectionArray Nanite::BuildMeshSections (const FStaticMeshSectionArray &InSections)
 
FStaticMeshSectionArray Nanite::BuildStaticMeshSections (const FMeshDataSectionArray &InSections)
 
 IMPLEMENT_VERTEX_FACTORY_TYPE (FNaniteVertexFactory, "/Engine/Private/Nanite/NaniteVertexFactory.ush", EVertexFactoryFlags::UsedWithMaterials|EVertexFactoryFlags::SupportsStaticLighting|EVertexFactoryFlags::SupportsPrimitiveIdStream|EVertexFactoryFlags::SupportsNaniteRendering|EVertexFactoryFlags::SupportsComputeShading|EVertexFactoryFlags::SupportsManualVertexFetch|EVertexFactoryFlags::SupportsRayTracing|EVertexFactoryFlags::SupportsLumenMeshCards|EVertexFactoryFlags::SupportsLandscape|EVertexFactoryFlags::SupportsPSOPrecaching)
 
void ClearNaniteResources (Nanite::FResources &InResources)
 
void ClearNaniteResources (TPimplPtr< Nanite::FResources > &InResources)
 
void InitNaniteResources (TPimplPtr< Nanite::FResources > &InResources, bool bRecreate)
 
uint64 GetNaniteResourcesSize (const TPimplPtr< Nanite::FResources > &InResources)
 
uint64 GetNaniteResourcesSize (const Nanite::FResources &InResources)
 
void GetNaniteResourcesSizeEx (const TPimplPtr< Nanite::FResources > &InResources, FResourceSizeEx &CumulativeResourceSize)
 
void GetNaniteResourcesSizeEx (const Nanite::FResources &InResources, FResourceSizeEx &CumulativeResourceSize)
 

Variables

int32 GNaniteAllowMaskedMaterials = 1
 
FAutoConsoleVariableRef CVarNaniteAllowMaskedMaterials (TEXT("r.Nanite.AllowMaskedMaterials"), GNaniteAllowMaskedMaterials, TEXT("Whether to allow meshes using masked materials to render using Nanite."), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;}), ECVF_RenderThreadSafe)
 
int32 GNaniteCustomDepthEnabled = 1
 
int32 GNaniteProxyRenderMode = 0
 
TAutoConsoleVariable< int32CVarDebugDrawSimpleBones
 
TAutoConsoleVariable< int32CVarDebugDrawBoneAxes
 
TGlobalResource< FVertexFactoryResourceNanite::GVertexFactoryResource
 

Function Documentation

◆ AllowLumenCardGenerationForSkeletalMeshes()

bool AllowLumenCardGenerationForSkeletalMeshes ( EShaderPlatform  Platform)
extern

◆ ClearNaniteResources() [1/2]

void ClearNaniteResources ( Nanite::FResources InResources)

◆ ClearNaniteResources() [2/2]

void ClearNaniteResources ( TPimplPtr< Nanite::FResources > &  InResources)

◆ CVarNaniteProxyRenderMode()

FAutoConsoleVariableRef CVarNaniteProxyRenderMode ( TEXT("r.Nanite.ProxyRenderMode")  ,
GNaniteProxyRenderMode  ,
TEXT(" 2: Disable rendering if Nanite is enabled on a mesh but is unsupported, except for static mesh editor toggle." ,
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;})  ,
ECVF_Scalability ECVF_RenderThreadSafe 
)

◆ DECLARE_LLM_MEMORY_STAT() [1/2]

DECLARE_LLM_MEMORY_STAT ( TEXT("Nanite")  ,
STAT_NaniteLLM  ,
STATGROUP_LLMFULL   
)

◆ DECLARE_LLM_MEMORY_STAT() [2/2]

DECLARE_LLM_MEMORY_STAT ( TEXT("Nanite")  ,
STAT_NaniteSummaryLLM  ,
STATGROUP_LLM   
)

◆ DEFINE_GPU_STAT() [1/2]

DEFINE_GPU_STAT ( NaniteReadback  )

◆ DEFINE_GPU_STAT() [2/2]

DEFINE_GPU_STAT ( NaniteStreaming  )

◆ GetNaniteResourcesSize() [1/2]

uint64 GetNaniteResourcesSize ( const Nanite::FResources InResources)

◆ GetNaniteResourcesSize() [2/2]

uint64 GetNaniteResourcesSize ( const TPimplPtr< Nanite::FResources > &  InResources)

◆ GetNaniteResourcesSizeEx() [1/2]

void GetNaniteResourcesSizeEx ( const Nanite::FResources InResources,
FResourceSizeEx CumulativeResourceSize 
)

◆ GetNaniteResourcesSizeEx() [2/2]

void GetNaniteResourcesSizeEx ( const TPimplPtr< Nanite::FResources > &  InResources,
FResourceSizeEx CumulativeResourceSize 
)

◆ IMPLEMENT_VERTEX_FACTORY_TYPE()

◆ InitNaniteResources()

void InitNaniteResources ( TPimplPtr< Nanite::FResources > &  InResources,
bool  bRecreate 
)

◆ LLM_DEFINE_TAG()

LLM_DEFINE_TAG ( Nanite  ,
NAME_None  ,
NAME_None  ,
GET_STATFNAME(STAT_NaniteLLM ,
GET_STATFNAME(STAT_NaniteSummaryLLM  
)

Variable Documentation

◆ CVarDebugDrawBoneAxes

TAutoConsoleVariable<int32> CVarDebugDrawBoneAxes
extern

◆ CVarDebugDrawSimpleBones

TAutoConsoleVariable<int32> CVarDebugDrawSimpleBones
extern

◆ CVarNaniteAllowMaskedMaterials

FAutoConsoleVariableRef CVarNaniteAllowMaskedMaterials(TEXT("r.Nanite.AllowMaskedMaterials"), GNaniteAllowMaskedMaterials, TEXT("Whether to allow meshes using masked materials to render using Nanite."), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context; }), ECVF_RenderThreadSafe) ( TEXT("r.Nanite.AllowMaskedMaterials")  ,
GNaniteAllowMaskedMaterials  ,
TEXT("Whether to allow meshes using masked materials to render using Nanite." ,
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *InVariable) { FGlobalComponentRecreateRenderStateContext Context;})  ,
ECVF_RenderThreadSafe   
)

◆ GNaniteAllowMaskedMaterials

int32 GNaniteAllowMaskedMaterials = 1

◆ GNaniteCustomDepthEnabled

int32 GNaniteCustomDepthEnabled = 1

◆ GNaniteProxyRenderMode

int32 GNaniteProxyRenderMode = 0