What is the most performant way of deforming vertices in a mesh with 70K -100K vertices?

Hi all,

I am using Procedural Mesh Component’s CreateMeshSection to create and then at each tick UpdateMeshSection to pass perturbed vertex positions to the render thread. However, this takes a hit of about 3-4ms, which seems a bit prohibitive just for passing an updated set of vertex locations around. Performance is crucial as we are targeting VR related applications and don’t have an enormous amount of render budget to play with. Any insights into this would be greatly appreciated.

Best,
darkz

Do you have collision enabled? That sounds kinda high without it even with the PMC not using a particularly friendly path for rapid updates like that. Is this all in one section?

I have collisions disabled.

Have you managed to squeeze more performance out of it ?

Yes everything is in a single section.

I have worked with the PMC quite a bit recently. The things that stand out to me currently are that the PMC uses a vertex struct that is 32 bytes each IIRC, so 100k vertices is about 3.2MB worth of vertex data. UpdateMeshSection currently will combine all the parts you feed it into whatever is existing data that you didn’t replace from previous Create/Update sections, and then copy it to the RT which will then send it to the GPU… copying 3.2MB isn’t something you want to do super often.

I see you said you have collision disabled, so the first thing I’d recommend is try breaking it up into a couple sections and see how it does. Be warned that if you start changing mesh topology, the indices, you’ll currently have to use CreateMeshSection which unfortunately rebuilds the scene proxy, that will cause a completely re-sync of the vertices/indices to the GPU so I’d be careful of using that.

Just for your information, the reason I asked about collision is when you update a section either through create/update it appends all of the sections together and sends it back to PhysX to re-bake it for use. So be very careful with collision if that’s something you’ll need at some point.

Separate from the answer, darkZ, feel free to contact me through Unreal Slack or other, I’m working on some things with the PMC to hopefully improve it for cases like this, as well as adding some other features.