SplineMeshVertexFactory 不支持缓存 MeshDrawCommand 的相关问题

我们做了一个大概有 2k~3k 个静态的 splineMeshComponent 的测试场景,发现瓶颈在 Render 线程的 MeshDrawCommandPassSetupTask 上。看了下相关代码发现由于 SplineMeshVertexFactory 的标记中没有 EVertexFactoryFlags::SupportsCachingMeshDrawCommands,​所以每帧都在动态 BuildDynamicMeshDrawCommand。

测试了一下添加缓存标志后该部分的开销就没了,看起来效果也是正确的,所以想请教下 SplineMeshVertexFactory 不做成缓存的 MeshDrawCommand 是否有什么设计上的考虑​

Steps to Reproduce

您好,

感谢您的咨询!

FLocalVertexFactory 是目前唯一支持缓存 MeshDrawCommand 的类型,因为它在设置 Shader 绑定时不需要视角信息。Mesh Pass Processor 只能在设置 Shader 绑定不需要视角信息的情况下缓存绘制命令,因为缓存期间 FSceneView 会是空值。

这个页面中列举了支持缓存绘制命令的所有条件:https://dev.epicgames.com/documentation/zh\-cn/unreal\-engine/mesh\-drawing\-pipeline\-in\-unreal\-engine?application\_version\=5\.5\#cachedmeshdrawcommands

我们会讨论能否为 FSplineMeshVertexFactory 加入绘制命令缓存支持,然后给您进一步的答复。

好的感谢答复,希望尽快看到是否支持的结论

您好,

在桌面端平台 FSplineMeshVertexFactory 现在添加了 GPUScene 的支持,所以是可以支持缓存 MeshDrawCommand 的。

请查看这个相关的工单中 Liu Wei (Epic Games) 的回答:

[Content removed]

希望这些信息可以帮到您。

好的,感谢回答,这个信息很有用

您好,

我现在会关闭这个工单。如果您对这个问题有更多疑问,可以随时重新开启这个工单。