What is the cheapest way to rotate objects?

I’m looking to rotate some of my objects in the level and would love an option to control the rotation speed and direction. However, I’m concerned about how to handle shadow cache invalidation when the rotation occurs.

After some research, I found several possible methods to achieve this:

  • Shaders
  • Blueprints
  • Niagara

Does anyone know a way (one of above or something new) to tick all the boxes I need while still being performant?

When you say handle shadow cache invalidation, handle it how exactly? What’s your desired outcome?

No matter what method you choose to rotate the object, if it would impact the appearance of its shadow, the shadow cache must be invalidated.

One optimization could perhaps be to not invalidate every frame. Small amounts of movement often don’t cause noticable artifacts, but players may notice if the shadow updates at a frame rate lower than the model.

Nanite meshes draw into VSM cache much more efficiently, but on the other hand nanite isn’t super efficient when it comes to vertex shader animation.

It could be faster to animate nanite objects on CPU with blueprints/code and animate non-nanite objects via gpu shader. Really no way to know without profiling.

Some models are possible to rotate without the need for invalidation at all. Specifically radially symmetrical objects, like spheres and cylinders. As they rotate along their axis of symmetry, their shape doesn’t change - so the invalidation can be skipped entirely.