bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Improve update_mesh_previous_global_transforms() performance

Open JMS55 opened this issue 1 year ago • 4 comments

  • Using try_insert for every entity is expensive. We should have a system to first add PreviousGlobalTransform to entities missing it, and then a second system to update the value. Or something like that.
  • When using the meshlet feature, but no motion vector prepass, Mesh entities unnecessarily get a PreviousGlobalTransform. Not really worth fixing imo, as you probably want to use TAA with meshlets anyways, but I'm making a note of it here.

JMS55 avatar Aug 09 '24 15:08 JMS55

I would like to complete this task, but I'm not sure if it will conflict with your current work.

re0312 avatar Aug 09 '24 15:08 re0312

Feel free to, it won't conflict with any active work that I know of. The only reason I haven't done it myself is that I don't have a computer to benchmark on atm.

JMS55 avatar Aug 09 '24 16:08 JMS55

Another option would be to include PreviousGlobalTransform in MeshMaterialBundle behind a cargo feature, instead of having a system to add it to entities that don't have it.

JMS55 avatar Aug 09 '24 21:08 JMS55

With required components, I'm tempted to make PreviousGlobalTransform required for MeshletMesh3d. How to solve this for the general case, idk yet.

JMS55 avatar Oct 13 '24 00:10 JMS55