Search Unity

Best textures format/tips to use for a 2D style game

Discussion in 'iOS and tvOS' started by mediashock, Jan 28, 2011.

  1. mediashock

    mediashock

    Joined:
    Apr 15, 2009
    Posts:
    65
    I am using roughly 3 or 4 1024X1024 textures for each of my levels, they are eating quote a bit of memory, when i drop it to PVRTC the image looks really crappy. Any tips or suggestions on how i could improve this?
     
  2. JamesMobot

    JamesMobot

    Joined:
    Jul 8, 2010
    Posts:
    170
    If it's 2d you can try setting your images to advanced and turning off mipmaps.

    It seems that and 16bit is a good middle ground.

    Super iPhone compression looks awful for 2d. It seems it's really meamt more for 3d texture where you not rely on crisp detail.
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Depends. I think the banding of 16-bit tends to look more objectionable than the blur of PVRTC 4 bpp. Alphas can get pretty mangled by PVRTC, so if your edges look bad, but otherwise you can live with it, you can rewrite your shaders, and use a lovely 8-bit alpha. That's a total of 12 bits. Of course, the RGB channels will look better, without having to waste data on the alpha, too.
     
  4. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    I would look into using Resources.Load and Resources.UnloadUnusedAssets to alleviate your memory concerns. By manually loading and unloading objects as they are no longer needed, you can have a theoretically infinite amount of high res, uncompressed textures, provided that you only need to have X amount visible at any given time. Depending on how your game plays it might be all you need.
     
  5. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Just wanted to add that this depends on the type of graphics off course. If the image doesn't have gradients (pixel art, some vector art, etc), 16 bit can be ideal.

    One thing you can try is having your textures at double resolution (if you have them at a high resolution) but with PVRTC. I believe they would still only need half the ram, and the compression might not be as bad.
    Off course 2048x2048 textures won't work on older devices, so you might have to split the images up. But I'd check first if it looks acceptable.
     
  6. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    I looked up the docs, what I don't understand is how to selectively unload stuff. I have the impression that Resources.UnloadUnusedAssets is not performed per asset ie I cannot say something like "unload this texture". I guess that I have not understand your answer, probably because of my limited knowledge on this matter. Could you plase give an example on how this function can be useful ?
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You don't need it to be selective.
    unloading something thats no longer needed is good and expected practise on mobiles.

    This also means that before you call this function, you destroy all objects and manually loaded textures you no longer need so they can be collected at all for example.
     
  8. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Thanks for the explanation.
    So first destroy all references to the assets, then destroy the assets, then call Resources.UnloadUnusedAssets.
    Resources.Load is used in the creation of objects. Good to know :)
    I guess that this should take place during a static screen (ie level achievements) so no hitches come up from the creation/destruction of the objects.