vault backup: 2024-11-14 16:24:53
This commit is contained in:
parent
39c710b19c
commit
8d62faa1cd
@ -7,85 +7,14 @@ rating: ⭐
|
|||||||
---
|
---
|
||||||
# 前言
|
# 前言
|
||||||
探索思路:
|
探索思路:
|
||||||
- [ ] SceneProxy收集机制的改变。
|
|
||||||
- [ ] GetDynamicMeshElements的调用方式。
|
|
||||||
- [ ] 在SendRenderDynamicData_Concurrent中添加(模仿USkeletalMeshComponent::SendRenderDynamicData_Concurrent()与FDebugSkelMeshSceneProxy)
|
|
||||||
|
|
||||||
# GetDynamicMeshElements
|
|
||||||
看得出主要在FDynamicMeshElementContext::GatherDynamicMeshElementsForPrimitive()中调用Primitive->Proxy->GetDynamicMeshElements()。
|
|
||||||
|
|
||||||
|
# 问题解决方法
|
||||||
|
添加相关性overrider,将bDynamicRelevance设置成true。
|
||||||
```c++
|
```c++
|
||||||
UE::Tasks::FTask FDynamicMeshElementContext::LaunchAsyncTask(FDynamicPrimitiveIndexQueue* PrimitiveIndexQueue, UE::Tasks::ETaskPriority TaskPriority)
|
FPrimitiveViewRelevance FOutlineSkeletalMeshSceneProxy::GetViewRelevance(const FSceneView* View) const
|
||||||
{
|
{
|
||||||
return Pipe.Launch(UE_SOURCE_LOCATION, [this, PrimitiveIndexQueue]
|
FPrimitiveViewRelevance Result = FSkeletalMeshSceneProxy::GetViewRelevance(View);
|
||||||
{
|
Result.bDynamicRelevance = true;
|
||||||
FOptionalTaskTagScope Scope(ETaskTag::EParallelRenderingThread);
|
return Result;
|
||||||
FDynamicPrimitiveIndex PrimitiveIndex;
|
|
||||||
|
|
||||||
while (PrimitiveIndexQueue->Pop(PrimitiveIndex))
|
|
||||||
{
|
|
||||||
GatherDynamicMeshElementsForPrimitive(Primitives[PrimitiveIndex.Index], PrimitiveIndex.ViewMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WITH_EDITOR
|
|
||||||
while (PrimitiveIndexQueue->PopEditor(PrimitiveIndex))
|
|
||||||
{
|
|
||||||
GatherDynamicMeshElementsForEditorPrimitive(Primitives[PrimitiveIndex.Index], PrimitiveIndex.ViewMask);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}, TaskPriority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FDynamicMeshElementContext::GatherDynamicMeshElementsForPrimitive(FPrimitiveSceneInfo* Primitive, uint8 ViewMask)
|
|
||||||
{
|
|
||||||
SCOPED_NAMED_EVENT(DynamicPrimitive, FColor::Magenta);
|
|
||||||
|
|
||||||
TArray<int32, TInlineAllocator<4>> MeshBatchCountBefore;
|
|
||||||
MeshBatchCountBefore.SetNumUninitialized(Views.Num());
|
|
||||||
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
|
|
||||||
{
|
|
||||||
MeshBatchCountBefore[ViewIndex] = MeshCollector.GetMeshBatchCount(ViewIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
MeshCollector.SetPrimitive(Primitive->Proxy, Primitive->DefaultDynamicHitProxyId);
|
|
||||||
|
|
||||||
// If Custom Render Passes aren't in use, there will be only one group, which is the common case.
|
|
||||||
if (ViewFamilyGroups.Num() == 1 || Primitive->Proxy->SinglePassGDME())
|
|
||||||
{
|
|
||||||
Primitive->Proxy->GetDynamicMeshElements(FirstViewFamily.AllViews, FirstViewFamily, ViewMask, MeshCollector);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (FViewFamilyGroup& Group : ViewFamilyGroups)
|
|
||||||
{
|
|
||||||
if (uint8 MaskedViewMask = ViewMask & Group.ViewSubsetMask)
|
|
||||||
{
|
|
||||||
Primitive->Proxy->GetDynamicMeshElements(FirstViewFamily.AllViews, *Group.Family, MaskedViewMask, MeshCollector);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
|
|
||||||
{
|
|
||||||
FViewInfo& View = *Views[ViewIndex];
|
|
||||||
|
|
||||||
if (ViewMask & (1 << ViewIndex))
|
|
||||||
{
|
|
||||||
FDynamicPrimitive& DynamicPrimitive = DynamicPrimitives.Emplace_GetRef();
|
|
||||||
DynamicPrimitive.PrimitiveIndex = Primitive->GetIndex();
|
|
||||||
DynamicPrimitive.ViewIndex = ViewIndex;
|
|
||||||
DynamicPrimitive.StartElementIndex = MeshBatchCountBefore[ViewIndex];
|
|
||||||
DynamicPrimitive.EndElementIndex = MeshCollector.GetMeshBatchCount(ViewIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# SendRenderDynamicData_Concurrent
|
|
||||||
|
|
||||||
## FDebugSkelMeshSceneProxy::GetDynamicMeshElements
|
|
||||||
|
|
||||||
|
|
||||||
# 其他?
|
|
||||||
|
|
||||||
MeshBuilderSurface.GetMesh(GetLocalToWorld(), MatProxySurface, SDPG_Foreground, false, false, ViewIndex, Collector);
|
|
Loading…
x
Reference in New Issue
Block a user