Monday, September 3, 2018

2D animation: Animated 3D models or sprites with animation frames?


Starting out with new project, I am stuck choosing between:



  • 3D textured model animated directly through the renderer

  • 2D sprites and drawing each animation frame


The game will be 2D platform, I would like the pros and cons of each method to help make a decision between the two.




Answer



The pros of using animated sprites are:



  1. Ease of use: simply switch each frame to animate a sprite. There are already many tools developed for generating sprite sheets and animating them, many of them available from the Unity Asset Store. Doing so opens up a huge amount of productivity for a simple game.

  2. Easy collision detection: Since each sprite is defined by a frame, it is trivial to use that frame as a bounding box in your world. If your sprites have alpha, it's not too difficult to preprocess the non-transparent pixels to use as bounds. Comparing collision against bounding boxes is very fast as well.


The cons of using animated sprites are:




  1. Memory Usage: If you have a lot of sprites with a lot of animation, you're going to need a lot of memory to store each of those images. This can quickly get out of hand if you're targeting a mobile device or you plan on having many different animated sprites on your screen at once. This can be remedied by techniques such as texture compression. For small projects (or projects with low quality sprites) this is usually not an issue.





  2. Smoothness: There is no ability to ease animation with sprites. In general, you will have choppy animations if you do not animate everything to an extremely fine level. This is usually not an issue for games with 8-bit graphics, but if you're debating between using sprites and animated skeletal models, you should be aware that you're going to have to have a lot of animation frames to get smooth looking animations.




  3. No animation blending: This folds into the previous point, but you're likely not going to be able to do things like look in a certain direction while jumping if you use sprites for animation. If you want to split up the abilities your character can do, or have your animations interact with things in your world (like grabbing a door handle), then you will need a separate sprite for each height of door handle. Again, this isn't too much of a problem if you have a simple game, but it can easily become one if you're thinking about something more complicated.




The pros and cons for animation blending are more or less the inverse of the pros and cons for sprite usage. In general, you want to use animated models for





  1. Animation blending: For example, if you want to be able to move and shoot a gun in a particular direction at the same time and want it to look good, you can use animation blending. This is a little tricky to implement, but Unity has these features built in for you so you don't need to worry too much about it.




  2. Smooth animations: Everything is interpolated, meaning that everything looks smooth and nice. Transitioning from one animation to another is fluid and looks good.




The cons are:





  1. Development: You need a separate skill set to properly implement animated skeletal models. This is something that is sometimes hard for people that are used to sprite animation to handle, but with enough practice everything works out.




  2. Implementation: Although Unity will handle most of the heavy lifting for you, if you want to implement skeletal animation, you have to figure out how to specify which animations will blend with which other animations and integrate that into your game and event system. This isn't a trivial programming task, but again, Unity should take care of that.




My advice is to use sprite animation for anything that isn't an overly complicated object. Things like power-ups, and simple monsters are great for sprite animation. If you have a very complex main character that can do a lot of different things, these are triggers that should say, "Oh, I should probably use skeletal animation for this guy".


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...