big images and animation with spritesheet

Member
Posts: 164
Joined: 2010.10
Post: #1
i have to display an animation with all images are 960x640-pixel.
if i want to make a smooth animation i must have 18 images/sec.
a spritesheet with 18 images like that will be something like (960*18)x640.
what is scaring me is the loading time:
will it be acceptable?
if i have more sprites for the animation animation will it give problems in time or space in disk?
is there another way to load images for better performance?
thanks
Quote this message in a reply
Member
Posts: 65
Joined: 2009.01
Post: #2
I'm sure you could find ways to optimize your animation.
First of all, it is hard to believe that you really need to change every single pixel in the animation sequence on each frame, which is what your post suggests. Can't you separate it out into a static background image that has the moving parts of the image overlaid on top it?
Secondly, just because you have 18 frames per second, doesn't necessarily mean you need 18 different images per second. If you analyze most animations, they typically only have 10-12 unique images per second, with the rest being duplicates. (And that is at 24 fps). So you should be able to cut out some images that way.
Lastly, there are compression techniques available. Apple has released the WWDC 2010 videos, and I know this is covered in one of them.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
Texture Size:
You can't load a texture that big anyway. The max size of newer devices is 2048x2048 and 1024*1024 for older ones. You could group two frames per texture, but that is the best you will do.

Memory Usage:
That is also over 40MB of uncompressed data, so you are going to need to do something to get the size down. If you PVR and gzip compress the textures you can probably get it to 2-3MB on disk and 4-6 in RAM. Gzip is very fast to decompress, and the PVR texture data can be dumped directly into VRAM so this is probably your fastest loading time too.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
It sounds to me like you want to play a movie.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
(Dec 9, 2010 08:10 AM)ThemsAllTook Wrote:  It sounds to me like you want to play a movie.

I guess it wasn't clear if he only had 18 frames total though.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #6
thanks for the tips.
i explain the problem better:
i have a static background and a character large quote as the screen (so some background is visible but not so much)
while the game is in idle the character moves slightliy, like breathing or standing in guard position (like street fighter if i not move joistick)
if i make some action like touching the screen, the character began to move and has another animation and so on.

i thought that haveing all frames loaded i could switch between animation selecting what frame to start and what was the frame to finish, and loop between them.

i'm searching the right way to implement it, paying attention to: smooth animation

i have seen that 18fps was the minimum to trick the eye.
perhaps is best more movies?
can i have movie with a transparent background so the static background will be visible?
Quote this message in a reply
Member
Posts: 54
Joined: 2010.10
Post: #7
If your background is genuinely static, you could munge that into the movie as well.

Paul Johnson
Great Little War Game
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #8
(Dec 9, 2010 07:39 AM)johncmurphy Wrote:  Lastly, there are compression techniques available. Apple has released the WWDC 2010 videos, and I know this is covered in one of them.

hadn't found it...many topics covered, but i haven't seen video compression

so the best result will be with a video?

should i try with a mpeg4?
thanks
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #9
can i make more videos playing one on the other?
i explain better:
a background animated, and a player character moving?

it is more expensive in cpu, resource, loading time ecc, makeing 2 videos playing one on the other, or loading multiple images and make an animation with that?
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2011.06
Post: #10
(Dec 10, 2010 02:06 AM)sefiroths Wrote:  thanks for the tips.
i explain the problem better:
i have a static background and a character large quote as the screen (so some background is visible but not so much)
while the game is in idle the character moves slightliy, like breathing or standing in guard position (like street fighter if i not move joistick)
if i make some action like touching the screen, the character began to move and has another animation and so on.

i thought that haveing all frames loaded i could switch between animation selecting what frame to start and what was the frame to finish, and loop between them.

i'm searching the right way to implement it, paying attention to: smooth animation

i have seen that 18fps was the minimum to trick the eye.
perhaps is best more movies?
can i have movie with a transparent background so the static background will be visible?

It is going to be hard to get 18 FPS on iOS using static PNGs. This is because it takes too much CPU to decode the PNG image data in between frames. On an iPhone 3G, the best you will be able to do is about 11 FPS with full screen images.

For these kinds of frame rates, you will need an optimized implementation. Please have a look at the "Street Fighter II" example at this page:

http://www.modejong.com/AVAnimator/

This example shows an animation composite over a static background, it sounds like this is the exact thing you want to do. What is interesting about the example is that once the animation is prepared, it will blit onto the screen very quickly. You will also get very good compression results with the APNG or Quicktime Animation codec support included in this library, so your app download size will be smaller than if you use a series of PNG images.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
Why on earth would you even consider decoding PNGs each frame?
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2011.06
Post: #12
(Jun 8, 2011 04:54 PM)OneSadCookie Wrote:  Why on earth would you even consider decoding PNGs each frame?

sefiroths posted a question about how to animate a series of images with alpha channels, one would typically do that with a series of PNG images. If you have other image file format advice, I am sure sefiroths would love to hear it. I was simply pointing out that decoding time for compressed images is going to be an issue that will make it difficult to get the desired frame rates. The example xcode project link I posted does not use a series of PNG images, it decodes frames of image data from a Quicktime Animation file (this is far less CPU intensive).
Quote this message in a reply
Post Reply