Friday, April 17, 2009

8 bit PNG sprites, transparency and memory management

So far, I had been using 8 bit PNG sprites for almost all the resources. as it turns out, these sprites take way more resources than desired ... with one taking as much as 200 kb. so if you have two objects using the same sprite, that increases the memory usage exponentially.

The problematic part is that, if you make a sprite and rotate it, photoshop uses antialiasing, which creates a few transparent pixels around the slanting or curved edges of an object that is rotated. now wehn you convert that into an 8 bit PNG image, all the transparent pixels turn out to be white and thus all the sprites have ugly white outlines.

After much trial and error, I found out that the best way to avoid this is to rotate the entire image, not just the object with in the sprite. The problem that comes then is that the attributes of the image get distorted, so you cannot use the image as it is and have to extract the object from within the image.. the object that you wanted to rotate and then paste it into the sprite that you wanted to create. I end up making the same image twice ... which is a pain... if only I had 3D Studio Max, I could've created a space ship in 3D and used 3D studio Max to generate the frames for me, which would've looked much better and would've been easy to convert into PNG.

just my luck huh?

1 comment:

  1. do you know of a site thats has a bunch of free sprites for download? i am not an artist and need some for a free game i am making.

    ReplyDelete