Animation Group - manual frame controll performance gain

Can someone explain from where comes performance gain when animationGroup (from animated GLTF mesh imported from Blender) is manually “animated” via goToFrame() ?

I have tried it to manually decrease animation frame rate of objects in distance to get better performance AND I was thinking that it is trade-off (quality for FPS) but it seems like it is not. Even when I animate at full speed (move frame on every scene.render) it is way faster than default animation play.

I am just curious why ? What the default animation play does differently ? I was expecting to see cca the same FPS if I keep the 1:1 frame ratio. Is there something important that I am losing this way ? For my quite simple animations it feels like perfect zero-cost optimization at first glance (and offcourse I can get even better FPS when I actually lower the frame ratio as originally planned).

At first glance, I would put this into the “how to optimize scene” page, it feels like it can really help to everyone who need lot of separately animated objects. But maybe i am missing something important here ?

The default animation system calls RuntimeAnimation.animate to advance animations:

When you call goToFrame directly, this function is executed:

As you directly pass a frame number, all code related to frame calculation can be skipped. Also, animation events are not fired in the goToFrame case, so it could be a problem if you rely on them.

I can understand it saves time to directly call goToFrame because most of the code of animate is related to frame calculation.

That would be great to update the “how to optimize scene” page with your findings indeed!

1 Like

Thanx @Evgeni_Popov for these source codes (next time I will look there before posting my questions here). It makes things much clearer now.