Hello Guest

Author Topic: Draw performance regarding sprites with too much transparency  (Read 5355 times)

fgielow

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Hello!

I have heard on some other solutions that it would be bad to have images with large amounts of alpha, even though they are "empty", they would be "drawn", burdening performance a liiittle bit. I should worry about this with tk2d maps and sprites? I mean, if I have an 600x600px image on which there is just a 100x100 sphere in the middle, would all the 600x600 pxs be "drawn"? I noticed that when I use dicing, the sprite mesh on the editor appears all cut in small pieces, which are not completely transparent, without little pieces for the completely blank areas. That means that if I use dicing I do not lose performance on empty regions?

Ps.: Here is an screenshot of the editor showing the small pieces I said:




Thanks in advance!
« Last Edit: April 10, 2013, 12:52:36 am by fgielow »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Draw performance regarding sprites with too much transparency
« Reply #1 on: April 10, 2013, 01:11:39 am »
That sprite there is pretty tiny. It isn't really worth it on this sprite. Its hard to quantify, but animating increased polygon count will also increase CPU overhead.

If on the other hand, you had 2-3 background sprites overlaid on each other, you'd definitely want to do this.

To answer your question if you have a 600x600 image with 100x100 sphere in the middle, 2D Toolkit will likely trim it, meaning you shouldn't have any issues with it.

fgielow

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Draw performance regarding sprites with too much transparency
« Reply #2 on: April 10, 2013, 01:50:01 am »
In my case I am dicing my character sprites because there are many animations. Dicing all the sprites to several 32x32 blocks is still producing an almost full 2048x1024 atlas.
I am dicing them that way so I can be more efficient on space and also use only one atlas with one material.

Apart from the initial overhead to recompose the sprites in order to draw them, do you think I may run into issues later on if I keep doing things like this?
I feel I should already ask because it may be hellish to later on decompose on more than one atlas map :P haha


Thanks again, I appreciate the quick reply.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Draw performance regarding sprites with too much transparency
« Reply #3 on: April 10, 2013, 02:04:53 am »
No but the runtime overhead of animating these sprites will be higher than normal sprites, ie every time a frame changes. But it's not massive and it definitely can be optimised further at a later date.