UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SkeletalRenderPublic.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 SkeletalRenderPublic.h: Definitions and inline code for rendering SkeletalMeshComponent
5=============================================================================*/
6#pragma once
7
8#include "CoreMinimal.h"
9#include "Stats/Stats.h"
11#include "PackedNormal.h"
13#include "RenderUtils.h"
14#include "Engine/SkeletalMesh.h"
16#include "MeshUVChannelInfo.h"
17#include "SkeletalMeshTypes.h"
18#include "RenderMath.h"
19#include "Async/Mutex.h"
20#include "Matrix3x4.h"
21
23class FVertexFactory;
24class UMorphTarget;
26struct FCachedGeometry;
27struct FRWBuffer;
32class FRHICommandList;
33class FRDGBuilder;
34namespace Nanite
35{
36 struct FMaterialAudit;
37}
38
40{
41 // Returns the maximum value allowed for morph targets blend weights, configured at RenderSettings
43}
44
60
69
76
83
85{
86public:
89
91
96
100 virtual void ReleaseResources() = 0;
101
111
116 UE_DEPRECATED(5.5, "PreGDMECallback is no longer used")
117 virtual void PreGDMECallback(FRHICommandList& RHICmdList, class FGPUSkinCache* GPUSkinCache, uint32 FrameNumber) {}
118
126
131
132 UE_DEPRECATED(5.5, "This method is no longer in use")
134
138 virtual bool IsCPUSkinned() const { return false; }
139
143 virtual bool IsGPUSkinMesh() const { return false; }
144
148 virtual bool IsNaniteMesh() const { return false; }
149
153 virtual const Nanite::FMaterialAudit* GetNaniteMaterials() const { return nullptr; }
154
160
166
172 {
173 // Not implemented
174 checkNoEntry();
176 }
177
178 UE_DEPRECATED(5.7, "Use GetReferenceToLocalMatrices instead")
180 {
181 checkNoEntry();
182 return nullptr;
183 }
184
185 UE_DEPRECATED(5.7, "Use GetPrevReferenceToLocalMatrices instead")
187 {
188 checkNoEntry();
189 return nullptr;
190 }
191
193
197 virtual bool GetCachedGeometry(FRDGBuilder& GraphBuilder, FCachedGeometry& OutCachedGeometry) const { return false; }
198
199 UE_DEPRECATED(5.6, "GetCachedGeometry now requires a GraphBuilder")
201
208
210 virtual int32 GetLOD() const = 0;
218 virtual void EnableOverlayRendering(bool bEnabled, const TArray<int32>* InBonesOfInterest, const TArray<UMorphTarget*>* MorphTargetOfInterest) {}
219
229
235 void UpdateMinDesiredLODLevel(const FSceneView* View, const FBoxSphereBounds& Bounds);
236
240 virtual bool HaveValidDynamicData() const = 0;
241
242 // allow access to mesh component
247
250
253
259
266 void SetHiddenMaterials(int32 InLODIndex,const TArray<bool>& HiddenMaterials);
267
275
280
284 inline uint32 GetComponentId() const { return ComponentId; }
285
286 inline TStatId GetStatId() const { return StatId; }
287
290
292
294 FName GetAssetPathName(int32 LODIndex = -1) const;
295
296#if RHI_RAYTRACING
298 virtual FRayTracingGeometry* GetRayTracingGeometry() { return nullptr; }
299 virtual const FRayTracingGeometry* GetRayTracingGeometry() const { return nullptr; }
300 virtual const FRayTracingGeometry* GetStaticRayTracingGeometry() const { return nullptr; }
301 virtual FRWBuffer* GetRayTracingDynamicVertexBuffer() { return nullptr; }
302 virtual int32 GetRayTracingLOD() const { return GetLOD(); }
303
304 virtual bool ShouldUseSeparateSkinCacheEntryForRayTracing() const { return GetLOD() != GetRayTracingLOD(); }
306
309
311 UE_DEPRECATED(5.6, "QueuePendingRayTracingGeometryUpdate is no longer used, but bRequiresRebuild flag on FRayTracingGeometry is used to check if ray tracing geometry needs to be updated during FRayTracingGeometry")
313
314#endif // RHI_RAYTRACING
315
317 virtual void SetTransform(const FMatrix& InNewLocalToWorld, uint32 FrameNumber) {};
318
320 virtual void RefreshClothingTransforms(const FMatrix& InNewLocalToWorld, uint32 FrameNumber) {};
321
324 {
327
330
336
337#if RHI_ENABLE_RESOURCE_INFO
339#endif
340 };
341
343
345
354
360
363
366
369
370#if RHI_RAYTRACING
374#endif
375
376#if UE_BUILD_SHIPPING
377 FName GetDebugName() const { return FName(); }
378#else
379 FName GetDebugName() const { return DebugName; }
381#endif // !UE_BUILD_SHIPPING
382
383#if WITH_EDITORONLY_DATA
387
392#endif
393
396 {
397 return FeatureLevel;
398 }
399
401 {
403 }
404
410 float GetScreenSize(int32 LODIndex) const;
411
414
417
419 virtual const FSkinWeightVertexBuffer* GetSkinWeightVertexBuffer(int32 LODIndex) const { return nullptr; }
420
422 virtual int32 GetDynamicBoundsStartOffset(int32 LODIndex) const { return -1; }
423
424protected:
427
430
433
436
441
444
447
450
453
455
456#if RHI_ENABLE_RESOURCE_INFO
458#endif
459};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define checkNoEntry()
Definition AssertionMacros.h:316
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::Math::TVector< float > FVector3f
Definition MathFwd.h:73
@ MAX_TEXCOORDS
Definition MeshUVChannelInfo.h:8
const bool
Definition NetworkReplayStreaming.h:178
FVector GenerateYAxis(const VectorType &XAxis, const VectorType &ZAxis)
Definition RenderMath.h:49
ESkinVertexFactoryMode
Definition SkeletalMeshTypes.h:51
EPreviousBoneTransformUpdateMode
Definition SkeletalRenderPublic.h:62
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ColorVertexBuffer.h:16
Definition RenderDeferredCleanup.h:11
Definition SkeletalRenderCPUSkin.h:29
Definition SkeletalRenderGPUSkin.h:52
Definition GPUSkinCache.cpp:584
Definition GPUSkinCache.h:126
Definition MeshDeformerGeometry.h:12
Definition NameTypes.h:617
Definition PrimitiveDrawInterface.h:19
Definition PrimitiveSceneProxy.h:296
Definition RenderGraphBuilder.h:49
Definition RHICommandList.h:455
Definition RHICommandList.h:3819
Definition RayTracingGeometry.h:31
Definition SceneView.h:1425
Definition SkeletalMeshLODRenderData.h:128
Definition SkeletalRenderPublic.h:85
float GetScreenSize(int32 LODIndex) const
Definition SkeletalRender.cpp:284
virtual const FVertexFactory * GetSkinVertexFactory(const FSceneView *View, int32 LODIndex, int32 ChunkIdx, ESkinVertexFactoryMode VFMode=ESkinVertexFactoryMode::Default) const =0
float WorkingMaxDistanceFactor
Definition SkeletalRenderPublic.h:365
virtual bool IsGPUSkinMesh() const
Definition SkeletalRenderPublic.h:143
bool bUsePerBoneMotionBlur
Definition SkeletalRenderPublic.h:440
float MaxDistanceFactor
Definition SkeletalRenderPublic.h:359
FName GetDebugName() const
Definition SkeletalRenderPublic.h:379
int32 WorkingMinDesiredLODLevel
Definition SkeletalRenderPublic.h:362
virtual void Update(int32 LODIndex, const FSkinnedMeshSceneProxyDynamicData &InDynamicData, const FPrimitiveSceneProxy *InSceneProxy, const USkinnedAsset *InSkinnedAsset, const FMorphTargetWeightMap &InActiveMorphTargets, const TArray< float > &InMorphTargetWeights, EPreviousBoneTransformUpdateMode PreviousBoneTransformUpdateMode, const FExternalMorphWeightData &InExternalMorphWeightData)=0
virtual void PreGDMECallback(FRHICommandList &RHICmdList, class FGPUSkinCache *GPUSkinCache, uint32 FrameNumber)
Definition SkeletalRenderPublic.h:117
bool ShouldUsePerBoneMotionBlur() const
Definition SkeletalRenderPublic.h:249
virtual void UpdateSkinWeightBuffer(const TArrayView< const FSkelMeshComponentLODInfo > InLODInfo)=0
virtual void ReleaseResources()=0
uint32 GetComponentId() const
Definition SkeletalRenderPublic.h:284
FGPUSkinCacheEntry * SkinCacheEntry
Definition SkeletalRenderPublic.h:428
ERHIFeatureLevel::Type FeatureLevel
Definition SkeletalRenderPublic.h:449
virtual void DrawVertexElements(FPrimitiveDrawInterface *PDI, const FMatrix &ToWorldSpace, bool bDrawNormals, bool bDrawTangents, bool bDrawBinormals) const
Definition SkeletalRenderPublic.h:228
FColor GetSkinCacheVisualizationDebugColor(const FName &GPUSkinCacheVisualizationMode, uint32 SectionIndex) const
Definition SkeletalRender.cpp:220
bool bSupportsStaticRelevance
Definition SkeletalRenderPublic.h:443
virtual const FSkinWeightVertexBuffer * GetSkinWeightVertexBuffer(int32 LODIndex) const
Definition SkeletalRenderPublic.h:419
FSkeletalMeshRenderData & GetSkeletalMeshRenderData() const
Definition SkeletalRenderPublic.h:289
virtual void EnableOverlayRendering(bool bEnabled, const TArray< int32 > *InBonesOfInterest, const TArray< UMorphTarget * > *MorphTargetOfInterest)
Definition SkeletalRenderPublic.h:218
TStatId StatId
Definition SkeletalRenderPublic.h:446
bool bHasBeenUpdatedAtLeastOnce
Definition SkeletalRenderPublic.h:368
uint32 ComponentId
Definition SkeletalRenderPublic.h:452
void SetHiddenMaterials(int32 InLODIndex, const TArray< bool > &HiddenMaterials)
Definition SkeletalRender.cpp:236
virtual TConstArrayView< FMatrix44f > GetPrevReferenceToLocalMatrices() const
Definition SkeletalRenderPublic.h:171
ENGINE_API const TArray< FSkelMeshRenderSection > & GetRenderSections(int32 InLODIndex) const
Definition SkeletalRender.cpp:214
ERHIFeatureLevel::Type GetFeatureLevel() const
Definition SkeletalRenderPublic.h:395
virtual int32 GetLOD() const =0
virtual const TArray< FMatrix3x4 > * GetPreviousBoneTransforms() const
Definition SkeletalRenderPublic.h:186
bool IsMaterialHidden(int32 InLODIndex, int32 MaterialIdx) const
Definition SkeletalRender.cpp:251
virtual const FVertexFactory * GetStaticSkinVertexFactory(int32 LODIndex, int32 ChunkIdx, ESkinVertexFactoryMode VFMode) const =0
uint32 LastFrameNumber
Definition SkeletalRenderPublic.h:432
virtual void InitResources(const FSkinnedMeshSceneProxyDesc &InMeshDesc)=0
virtual const Nanite::FMaterialAudit * GetNaniteMaterials() const
Definition SkeletalRenderPublic.h:153
FGPUSkinCacheEntry * SkinCacheEntryForRayTracing
Definition SkeletalRenderPublic.h:429
TArray< FSkelMeshObjectLODInfo > LODInfo
Definition SkeletalRenderPublic.h:342
virtual int32 GetDynamicBoundsStartOffset(int32 LODIndex) const
Definition SkeletalRenderPublic.h:422
virtual const TArray< FMatrix3x4 > * GetCurrentBoneTransforms() const
Definition SkeletalRenderPublic.h:179
void UpdateSkinWeightBuffer(const USkinnedMeshComponent *InMeshComponent)
Definition SkeletalRender.cpp:354
virtual void RefreshClothingTransforms(const FMatrix &InNewLocalToWorld, uint32 FrameNumber)
Definition SkeletalRenderPublic.h:320
virtual TConstArrayView< FMatrix44f > GetReferenceToLocalMatrices() const =0
FSkeletalMeshRenderData * SkeletalMeshRenderData
Definition SkeletalRenderPublic.h:426
void InitLODInfos(const TArrayView< const FSkelMeshComponentLODInfo > InComponentLODInfo, const USkinnedAsset *InSkinnedAsset)
Definition SkeletalRender.cpp:259
virtual FSkinningSceneExtensionProxy * CreateSceneExtensionProxy(const USkinnedAsset *InSkinnedAsset, bool bAllowScaling)
Definition SkeletalRender.cpp:349
virtual bool HaveValidDynamicData() const =0
virtual void SetTransform(const FMatrix &InNewLocalToWorld, uint32 FrameNumber)
Definition SkeletalRenderPublic.h:317
FName GetAssetPathName(int32 LODIndex=-1) const
Definition SkeletalRender.cpp:293
virtual const FSkinBatchVertexFactoryUserData * GetVertexFactoryUserData(const int32 LODIndex, int32 ChunkIdx, ESkinVertexFactoryMode VFMode) const
Definition SkeletalRenderPublic.h:133
bool SupportsStaticRelevance() const
Definition SkeletalRenderPublic.h:400
static FColorVertexBuffer * GetColorVertexBuffer(FSkeletalMeshLODRenderData &LODData, const FSkelMeshComponentLODInfo *CompLODInfo)
Definition SkeletalRender.cpp:330
virtual ENGINE_API ~FSkeletalMeshObject()
Definition SkeletalRender.cpp:121
TStatId GetStatId() const
Definition SkeletalRenderPublic.h:286
virtual bool GetCachedGeometry(FRDGBuilder &GraphBuilder, FCachedGeometry &OutCachedGeometry) const
Definition SkeletalRenderPublic.h:197
TArray< FCapsuleShape3f > ShadowCapsuleShapes
Definition SkeletalRenderPublic.h:344
int32 MinDesiredLODLevel
Definition SkeletalRenderPublic.h:353
UE::FMutex DesiredLODLevelMutex
Definition SkeletalRenderPublic.h:435
virtual bool IsNaniteMesh() const
Definition SkeletalRenderPublic.h:148
virtual void GetResourceSizeEx(FResourceSizeEx &CumulativeResourceSize)=0
static FSkinWeightVertexBuffer * GetSkinWeightVertexBuffer(FSkeletalMeshLODRenderData &LODData, const FSkelMeshComponentLODInfo *CompLODInfo)
Definition SkeletalRender.cpp:309
FName DebugName
Definition SkeletalRenderPublic.h:380
void UpdateMinDesiredLODLevel(const FSceneView *View, const FBoxSphereBounds &Bounds)
Definition SkeletalRender.cpp:125
virtual bool IsCPUSkinned() const
Definition SkeletalRenderPublic.h:138
FVector WorldScale
Definition SkeletalRenderPublic.h:454
virtual TArray< FTransform > * GetComponentSpaceTransforms() const =0
Definition SkeletalMeshRenderData.h:17
Definition SkeletalMeshSceneProxy.h:23
Definition SkeletalMeshSceneProxy.cpp:358
Definition SkinWeightVertexBuffer.h:364
Definition SkinningSceneExtensionProxy.h:17
Definition VertexFactory.h:661
Definition ArrayView.h:139
Definition Array.h:670
Definition Mutex.h:18
Definition MorphTarget.h:230
Definition SkinnedAsset.h:47
Definition SkinnedMeshComponent.h:258
Type
Definition RHIFeatureLevel.h:20
Definition SkinnedMeshComponent.h:50
Definition SkeletalRender.cpp:38
float GetMorphTargetMaxBlendWeight()
Definition SkeletalRender.cpp:39
Definition CachedGeometry.h:16
Definition Color.h:486
Definition ExternalMorphSet.h:42
Definition SkeletalRenderPublic.h:47
float U
Definition SkeletalRenderPublic.h:51
FVector2D TextureCoordinates[MAX_TEXCOORDS]
Definition SkeletalRenderPublic.h:53
FVector3f Position
Definition SkeletalRenderPublic.h:48
FPackedNormal TangentZ
Definition SkeletalRenderPublic.h:50
float V
Definition SkeletalRenderPublic.h:52
FPackedNormal TangentX
Definition SkeletalRenderPublic.h:49
FVector3f GetTangentY() const
Definition SkeletalRenderPublic.h:55
Definition PackedNormal.h:13
Definition PerPlatformProperties.h:304
Definition RHIUtilities.h:181
Definition ResourceSize.h:31
Definition SkinnedMeshComponent.h:175
Definition SkeletalMeshLODRenderData.h:28
Definition SkeletalRenderPublic.h:324
TArray< bool > HiddenMaterials
Definition SkeletalRenderPublic.h:326
float LODHysteresis
Definition SkeletalRenderPublic.h:335
FPerPlatformFloat ScreenSize
Definition SkeletalRenderPublic.h:329
Definition SkeletalRenderPublic.h:71
FGPUSkinCacheEntry * SkinCacheEntry
Definition SkeletalRenderPublic.h:72
int32 SectionIndex
Definition SkeletalRenderPublic.h:74
FMeshDeformerGeometry * DeformerGeometry
Definition SkeletalRenderPublic.h:73
Definition SkinnedMeshSceneProxyDesc.h:21
Definition SkinnedMeshSceneProxyDesc.h:117
Definition NaniteSceneProxy.h:66
Definition LightweightStats.h:416
Definition BoxSphereBounds.h:25
static CORE_API const TVector< double > OneVector
Definition Vector.h:82