0
\$\begingroup\$

I have a question regarding the method of creating a sprite-sheet so that it will not consume to much disk space and still preserve graphics quality.

I was researching about this topic and found that my sprite-sheets should have sizes that are a power of two. So valid sizes would be 512x512, 1024x1024, 2048x2048 etc.

Then I created two sprite sheets (one is 1024x1024 and the other is 2048x2048), they are exported as 16bit but they still use too much disk-space. How can I optimize my sprite-sheet to use the least amount of disk-space possible?

This is one of my sprites:

example sprite-sheet

\$\endgroup\$
8
  • \$\begingroup\$ Are you talking about storage consumption (eg. HDD space) or memory consumption on the GPU? Also why is 5.3MB too much? Why do you have to constrain the size to something smaller than, say, 5MB? \$\endgroup\$
    – bummzack
    Commented Mar 23, 2015 at 14:29
  • \$\begingroup\$ I'm talking both, GPU and storage memory, well I have a lot of sprites, for example I have 6 characters for now and in the update I will add more, and if each character takes 2-3 mb, and also I have around 10 backgrounds, if each background takes 2-3 mb thats alot, and also what do you think about what I said to set the max size to 512 for a sprite thats 1024 and also set it to truecolor, will that have any impact on the graphics or gpu ? \$\endgroup\$ Commented Mar 23, 2015 at 15:09
  • 1
    \$\begingroup\$ Are these sprite-sheets fully covered? You could pack several characters into one sheet. There also seem to be several concerns mixed into one question here, one seems to be about GPU memory usage and the other one is storage requirement. Both require different approaches. I suggest you try to simplify your question and focus on one issue at a time. \$\endgroup\$
    – bummzack
    Commented Mar 23, 2015 at 15:21
  • \$\begingroup\$ okay lets concentrate on storage consumption. And what do you think about setting the max size to 512 for a sprite thats 1024 x 1024 ? This could save me a lot of memory storage. And I'm not sure what do you mean about sprite sheets being fully covered, I have two friends that work with me, they do the graphic stuff and I program, thats why I dont know too much about graphics and creating graphics. \$\endgroup\$ Commented Mar 23, 2015 at 15:24
  • \$\begingroup\$ Usually a sprite sheet consists of several sprites, not only a single sprite. If you use one sheet per character, chances are that you have a lot of wasted space if you're sticking to the power of two square sizes. Please edit your question so that it is clearer. \$\endgroup\$
    – bummzack
    Commented Mar 23, 2015 at 15:43

2 Answers 2

2
\$\begingroup\$

I believe that in a lot of cases it's not worth investing huge amounts of time into optimizing assets to shave off a few MB of your final game. Sure, if you need to stay below a certain size limit (eg. 100MB for Apples policy for apps to transfer over cellular-networks), then it's reasonable.

A general optimization you can do is making use of some PNG optimizers (here's a tool that combines several of them). This can reduce the file size of a PNG considerably.

In your case, you could save even more space, by removing all redundant assets. You could remove all smaller variants of the circles. Simply scaling the sprite in unity is going to be enough to create the smaller circles (downscaling of sprites is usually fine and pretty much the same as pre-creating the smaller assets).

I'd probably even go further and just put one single circle into the sprite-sheet. Something like this:

circle with gradient sprite

Then create the different color-variants by setting the Color property in Unity (which will tint the sprite).

\$\endgroup\$
5
  • \$\begingroup\$ I though about this but I saw somewhere that tinting a sprite can disrupt batching or something like that... and also is it good to downscale a sprite? I mean as far as I know messing with the sprites scale is not a good idea, please tell me ur opinion about this. Also for me the problem is that maybe the size of the assets with unitys build will be near 50 mb and I want to publish my game on google play. Also will ImageOptim keep the quality of the image when it resizes it? \$\endgroup\$ Commented Mar 24, 2015 at 7:52
  • \$\begingroup\$ Tinting doesn't increase the amount of draw-calls. You can easily test that in Unity by creating several sprites and tinting them... As I've written in my answer: Downscaling is usually not a problem (upscaling is!). Especially with your circle sprites it's not going to be an issue. ImageOptim will preserve image-quality, yes (it won't resize the image, just optimize PNG compression). \$\endgroup\$
    – bummzack
    Commented Mar 24, 2015 at 8:34
  • \$\begingroup\$ aha okay thank you sir, this is very helpful, what do you advice me about backgrounds, i have around 10 bg that i would like to add in the game, since the bg's are going to be a little pixelated i told my frieds to create the image on 1920x1200 and then resize that same image to 1024x1024, and when i import them in unity i set the canvas scaler to scale based upon 1920 x 720 and it worked nice, the image is streched nicely and its ok, i want to hear your opinion about this method because i'm planing to use it in other games also. \$\endgroup\$ Commented Mar 24, 2015 at 9:18
  • \$\begingroup\$ So you create your original asset as 1920x1200, then scale it to 1024x1024 and stretch it back to 1920x1200 in Unity? Seems like a reasonable approach for backgrounds. I think it depends quite a lot on the actual artwork (whether or not the slight loss in quality is noticeable or not) \$\endgroup\$
    – bummzack
    Commented Mar 24, 2015 at 12:11
  • \$\begingroup\$ In this case its not noticeable, but thank you for your answer, I though I was making a stupid thing doing this but from your answer I see its ok. \$\endgroup\$ Commented Mar 24, 2015 at 14:07
0
\$\begingroup\$

I think you could save a lot of space if you drew those circles either as vectors (if Unity doesn't have vector graphics you can probably find libraries you can use with Unity that do) or if you had one circle and made coloured and resized versions in memory when your application runs.

If you pack your colourful food together on one 512x512 sheet and then those icons on another you'll find that you can save the icons at 8bit without losing quality (never save as jpg, the quality will be poor). You might still need to save colourful stuff at 16 or 32 bit, but you won't have as large a sheet to save them on.

Give saving your stuff as a png or gif a go. If it's still a little bloated you can shave off the metadata photoshop injects into its files with something like what this adobe forum post suggests.

\$\endgroup\$
1
  • \$\begingroup\$ All of my assets are saved as png, the only problem is that I have a lot of them, I though about this last night to save some stuff on 512x512, and what cant fit on 512 I'll save on 1024 \$\endgroup\$ Commented Mar 24, 2015 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .