Considering this question: "In a generic game engine where you have an object sprite (e.g. Unity), is it better (in terms of performance) to implement a clockwise rotation calculating at each frame the incremented rotation (e.g. having a quaternion "q" representing a rotation of n degrees and at each frame computing newrotation = q * oldrotation) or having say 20 snapshot sprites of a complete rotation and changing the sprite at each frame (effectively a 2D animation)? "

Is there a non engine-specific answer to this question? If so, which one?

  • 1
    \$\begingroup\$ I think it's really better to use the quaternion method because with 20 snapshots for each sprites you'll have really big textures, which can cause performance issues on older hardware. You will also have to create more sprites on the texture which can be really boring (even if you use some tools is still more work to do). With snapshots you won't be able to choose the rotation speed (you're bound to you're sprite number) if you want a smooth rotation. Finally since you'll need quaternion (or similar) to move sprite on the screen it'll be very simple to add one for rotation. \$\endgroup\$
    – Liuka
    Sep 8, 2016 at 8:55
  • 1
    \$\begingroup\$ The only reason you would want to have 20 snapshots of varying degrees of rotation, is if your sprites look different when they are rotated. Having multiple sprites will also be less fluid of a rotation as you are lockstepping through each frame instead of a free range rotation. That being said, if you are literally just rotating the sprite in a image editor and exporting the same image 20 times with varying rotation, that is very silly. \$\endgroup\$
    – jgallant
    Sep 8, 2016 at 10:59
  • 1
    \$\begingroup\$ Can you clarify, is your game using a low-res/retro pixel style? If so, rotating pixel art off the grid can cause the sprite to appear to shimmer, distort, or sparkle due to aliasing. For this reason many low-res games do choose to hand-animate rotations via a series of sprites, to get a more artist-controllable look. The effect is not very noticeable with high res textures or antialiasing though, so this wouldn't be a concern for more HD-style sprite games. \$\endgroup\$
    – DMGregory
    Sep 8, 2016 at 11:23
  • \$\begingroup\$ DMGregory it was a generic question but yeah I was thinking about a pixel art game. However my concerns were about performance as I specified in my edit. Thanks for the comment though. Liuka, Jon thanks it have a clearer view of the issue now. \$\endgroup\$
    – Alakanu
    Sep 9, 2016 at 9:51

1 Answer 1


There is no way that a animation will bring better performance wise than operating with a quaternion, let alone the memory difference. Think of it like this : Which one is easier ? Add 2+2 in your head or draw by hand using only dots a set of 2's a + sign a = sign and a 4? The answer is obvious.

  • \$\begingroup\$ Can you explain a bit further? I would think the opposite. You would need to perform calculations if you want to operate using a quaternion, whereas with many sprites you can just draw the next in the sequence. \$\endgroup\$
    – ndenarodev
    Sep 9, 2016 at 14:00
  • \$\begingroup\$ The analogy is quite flawed. Replace the 'draw by hand' with 'flip the page in a book' and you're closer. I would argue that a (non trivial) calculation is more complex than flipping a page. It comes down to flexibility: you can only use pictures from the book while you can create infinite calculations. Performance wise, the texture flipping likely wins. \$\endgroup\$
    – Felsir
    Sep 9, 2016 at 18:44

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .