2
\$\begingroup\$

I am developing a 2D game with Unity2D for Android, iOS, WebPlayer and maybe for desktop computers. I think the working resolution of my game is 1280*800.

How do I choose the optimal size of textures? May the textures be high resolution, for example 1920*1080? I read somewhere that it could be bad for devices with a small resolution.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

There are essentially two things to consider when thinking about the drawback of a larger texture size; performance and build size.

Large textures are more complex to render so have higher requirements of the hardware.

Large textures also make the build size much larger which may be an issue when considering the mobile market - mobile devices have less storage and, in the case of smart phones, the users are likely to want to download the application on a mobile broadband connection - 3g/4g etc - where build size often makes a difference in a person's decision to download an application.

These two factors need to be balanced with what you consider a minimum graphical quality on each platform.

The first thing to note in unity is that it's possible to have platform specific import settings in which you can dictate the maximum resolution for textures on a given platform. This is controlled in the texture importer window. The settings can also be toggled by scripts.

This page on reducing the build size discusses adjusting texture quality. Essentially it discusses the fact that textures tend to be the largest part of the build, so if the build is too big you should change the texture import settings to set a maximum size.

If performance is the only issue, the easiest way to adjust for that is to change the quality settings. It has a texture quality option in which you can tell the system to use full, half, quarter or eighth resolution. So for different platforms you could just set this value to something else. I don't think this affects the build size however.

\$\endgroup\$
5
  • \$\begingroup\$ Thank you for such a detailed response! Can i ask one more question? Why are my textures with high resolution looking bad in my game? I imported them into Unity with such options: maxSize = 2048 Format = truecolor TextureType = Sprite(2d)/nGUI FilterMode - point. But they are still looking bad and blurred. \$\endgroup\$
    – bukka.wh
    Commented Nov 13, 2014 at 10:52
  • \$\begingroup\$ It would be too hard to say really. Make that a separate question and include pictures of the problem. \$\endgroup\$ Commented Nov 13, 2014 at 11:00
  • \$\begingroup\$ First stop would be the quality settings I linked to in the answer. Maybe the texture quality setting isn't set to full res. \$\endgroup\$ Commented Nov 13, 2014 at 11:03
  • \$\begingroup\$ If they get blurred be aware to import them in "Advanced" mode and disable "Mip Mapping" generation. Next check if any level of compression or filter is applied. Sometimes the filter tend to eat details of your image. Also the best result is obtained when your textures are painted "pixel perfect" in your scene. \$\endgroup\$
    – Erik
    Commented Nov 13, 2014 at 11:26
  • \$\begingroup\$ This is my old question, where i described the trouble with quality and attached screenshots gamedev.stackexchange.com/questions/84541/… \$\endgroup\$
    – bukka.wh
    Commented Nov 13, 2014 at 11:29
1
\$\begingroup\$

Basically you have to balance - reduced number of draw calls - small memory footprint at runtime - small application package size (as already said)

I suggest to organize textures/sprites that are printed in the same scene in "Sprites Atlases" and keep the max resolution of atlases around 1024x1024 or 2048x2048. This, combined with some good scripting as NGUI, will reduce drastically your draw calls. Also try to organize the sprites based on the "layer" or "depth" they are printed at: for example put in a atlas all GUI sprites and in another all your "character sprites" (especially if you use 2D sprites animations".

At the other end if you have big images/texture you want to use as background, it's generally better to use them as isolated textures and get rid of them when you load another level.

When importing 2D sprites use advanced mode and disable MIP MAPPING, as you don't need it (they will be always at the same distance from the camera) and try both Point and Bilinear filter mode and see what gives you the best result.

If you want the best quality in a wide range of resolution (pixel perfect or near pixel perfect from 320x200 to 1920x1080) you may have to produce multiple versions of the same sprite atlases and decide which one to load at start time (when loading the game the first time).

\$\endgroup\$
6
  • \$\begingroup\$ Thank you for the answer! I'll try follow your recommendations. \$\endgroup\$
    – bukka.wh
    Commented Nov 13, 2014 at 12:36
  • \$\begingroup\$ Do you mean under "Sprites Atlases" this answers.unity3d.com/questions/627346/… ? (first answer) \$\endgroup\$
    – bukka.wh
    Commented Nov 13, 2014 at 12:41
  • \$\begingroup\$ I wasn't referring to any particular Menu or Script. Just to the general organization of sprites in atlases. I personally use NGUI Atlas Maker to pack my GUI sprites in one atlas and then use UISprite component. While for animating game sprites I use the SpriteManager2 asset u3d.as/content/above-and-beyond-software/sprite-manager-2-/1rf just beacause I find it more easy to manage animations clips and because I started developing 2D games before Unity 2D was out \$\endgroup\$
    – Erik
    Commented Nov 13, 2014 at 13:10
  • \$\begingroup\$ Okay, now i understood what is it. Thank you again! \$\endgroup\$
    – bukka.wh
    Commented Nov 13, 2014 at 15:18
  • \$\begingroup\$ mip mapping level isn't purely decided on distance from the camera and in the case of an orthographic camera, distance should make no difference at all. Different mip-map levels are picked generally by a surfaces final size, in pixels, on the screen vs the resolution of the texture applied to it. So mip-mapping may be useful in your 2D game, especially If you have lots of sprites using the same texture drawn at varying scales. \$\endgroup\$ Commented Nov 14, 2014 at 9:36

You must log in to answer this question.

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