-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
not calling LoadSynchronous() for every entity every frame and instead calling it once every chunk increases performance from 20 to 35 fps for 20k entities for me
So something like
UAnimToTextureDataAsset* CachedAsset = nullptr;
TSoftObjectPtr<UAnimToTextureDataAsset> CachedSoftAsset;
TMap<int32, FAnimToTextureAutoPlayData> PlayDataCache;
for (int EntityIdx = 0; EntityIdx < NumEntities; EntityIdx++)
if (VertexAnimInfoFragment.AnimToTextureData != CachedSoftAsset)
{
CachedSoftAsset = VertexAnimInfoFragment.AnimToTextureData;
CachedAsset = CachedSoftAsset.LoadSynchronous();
PlayDataCache.Reset();
}
if (CachedAsset)
{
FAnimToTextureAutoPlayData* PlayDataPtr = PlayDataCache.Find(AnimIndex);
if (!PlayDataPtr)
{
FAnimToTextureAutoPlayData NewPlayData;
if (UAnimToTextureInstancePlaybackLibrary::GetAutoPlayDataFromDataAsset(CachedAsset, AnimIndex, NewPlayData))
{
PlayDataPtr = &PlayDataCache.Add(VertexAnimInfoFragment.AnimationStateIndex, NewPlayData);
}
}
if (PlayDataPtr)
{
ISMInfo.AddBatchedCustomData<FAnimToTextureAutoPlayData>(*PlayDataPtr, RepresentationLODFragment.LODSignificance, RepresentationFragment.PrevLODSignificance, 0);
}```
Cheers!
Metadata
Metadata
Assignees
Labels
No labels