Hello Guest

Author Topic: Advice regarding spritesheet size and performance  (Read 5100 times)

Arnold

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
  • Create something you love!
    • View Profile
Advice regarding spritesheet size and performance
« on: February 08, 2014, 02:55:07 pm »
Hi!

I have a basic question how i should setup my atlases.

In my iOS game i will have 30 characters which i'm going to animate via Spine. Each character is composed of 3 bodyparts, a pair of eyes and a mouth. The different mouth types are universal (same for each char), the rest is specific for each char.

I have several ways of setting up my animations:

1) the body animation (only the 3 bodyparts per sheet), the eyes and mouth in one animation ( specific eyes + the mouth sprites in one sheet) and combine them to a layered anim via code (not very good to animate)

2) bodys, eyes and mouth in one sheet (per character), which means i have to copy the mouth sets 30 times ( a lot of duplicates)

3) every thing in one sheet ( bodys, eyes, and the mouth, everything) which would work on a 2048x2048 sprite sheet.

As i understand less bigger sheets are better than more smaller ones, because you save draw calls right?
The problem with the approach 3 is that when i want to add more chars, the one big spritesheet due to ios limitations of 2048, could be full. What would happen then?

What do you guys think is the best approach. Right now i would love to build it like No. 3, because the animation part will be the easiest.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Advice regarding spritesheet size and performance
« Reply #1 on: February 08, 2014, 10:35:31 pm »
I think its no question that the mouth should be repeated in the atlas, especially if its small and won't add significant overhead. Apart from that you want to try and limit draw calls.

#3 would be ideal, but as you say you'll run into trouble if you want to add more characters. Alternatively, you can have all the sprites for 1 character (+ duplicated mouth) in 1 collection. This will usually cause serious draw call overhead, but you can fully control that using the "Order in layer" setting. Use that to make sure everything is drawn in the right order, AND the draw calls are correct. You can write a script to evaluate this every frame based on visible characters, etc. Eg. you can do things at a higher level than Unity, you know that X object is one character, and you only need to sort characters with others.

Arnold

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
  • Create something you love!
    • View Profile
Re: Advice regarding spritesheet size and performance
« Reply #2 on: February 08, 2014, 10:39:35 pm »
thanks for the tips!
i evaluated my stuff and i will go with version 2, the overhead is ca. 2mb so it won't hurt my filesize that much, but makes everything else waaaay easier!