Search Unity

Memory: Importing Art Size

Discussion in 'Editor & General Support' started by renman3000, Feb 23, 2012.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,436
    Hi there,
    I am wondering if I import my art as a 256x256 vs a 1024x1024, how much am I improving the projects performance?

    Is it just a simple equation of this piece is 700kb, this piece is 350kb, therefore I am doubling my memory and therefore my performance is doubled too?
     
  2. Diviner

    Diviner

    Joined:
    May 8, 2010
    Posts:
    676
    The less the better. Make your textures as small as possible while they still look decent. Also, don't use the preset compression settings, go to Advanced and tweak everything until you drop the file size as low as possible without ruining its quality much. Do this for every texture you have in your project. Note that in GUI textures where you need the absolute best resolution possible, some times, especially when the texture doesn't use gradient filters, you can get away with 16bit instead of 32bit truecolor. This is a good way to cut 25% size from your GUI textures.

    In iPhone games, doing that is a must, especially if you want your games to run in pre-4S devices.

    As for your question, you don't improve performance at all by doing that, except for maybe faster scene loading and reducing the jittering that happens when you first render a new texture (although there are bypasses to this problem). What you do improve however is your chances that your app won't crash due to RAM consumption. As long as RAM can handle the textures, the frame rate (performance) is the same whether you use 256x256 or 2048x2048 textures.

    Note however that I base this opinion on experience, not on technical knowledge. As an iOS dev for over a year now, that's what I have concluded.
     
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,436
    Cool Diviner,
    Thank you so much.

    By "Going to Advance and adjusting the settings" you mean in Photoshop or whatever program you use correct? Not something in Unity?


    Other than that, I could not have hoped for a better answer.
    Cheers my friend
    Ren
     
  4. Diviner

    Diviner

    Joined:
    May 8, 2010
    Posts:
    676
    I mean inside Unity. On the Texture's Import Settings on the Inspector. You don't have to resize your textures in photoshop. If you select in the Texture import settings something like "Max Size : 512", your texture in the game will be at most 512x512 even if its real size is, say, 2048x2048. Assuming of course all your texture resolutions are in a power of 2 (ie 2x2, 4x4, 8x8, 16x16, 32x32, etc). That's the only way you can use PVRTC compression, which is essential in iOS builds for all non-GUI related textures. If your textures are not power of 2 by default, in the Advanced settings there's an option to round up to the highest or lowest power of 2 dimension. Tweak with that setting till you get the smallest size for the best visual.
     
  5. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,436
    So is this because Unity takes what it is given in terms of art but ports something else to XCode? So in that sense, settings in Photoshop do or do not matter? If they do, what should optimal settings via Photoshop be? 16 bit png?
     
  6. Diviner

    Diviner

    Joined:
    May 8, 2010
    Posts:
    676
    Settings in Photoshop don't matter at all. Don't bother with Photoshop, deal with Unity's settings. All you need to do in Photoshop is make sure the image's size in both x and y dimensions is a power of 2.
     
  7. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    No. I switched all textures in the scene to 64*64 and there was significant drop of drawcalls.
     
  8. NLSC-E-MS

    NLSC-E-MS

    Joined:
    Jul 22, 2010
    Posts:
    593
    I don't see how this could be unless some atlasing is being done.

    And static batching would only combine meshes using the same material (and some other rules...) but that wouldn't explain the reduced draw calls right?

    Can you elaborate more please?
     
  9. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,436
    @Diviner and or all,
    What do you feel is the best setting for an image that should suffer no distortion and is max 256POT?
     
  10. Diviner

    Diviner

    Joined:
    May 8, 2010
    Posts:
    676
    Depends on the image renman. Color palette is very important when working with PVRTC compression, and it's usually not something you have in mind when you draw a texture in PS. Filters are another important thing (gradients, grain, etc) which can affect how the final texture will look like in various settings. Depending on what your texture displays on the screen, and how it's used by the game, optimal Import settings will vary. Tweak until you get the best performance for the lowest size. It's all about trial and error here.

    As for Demostenes :

    Draw calls are not affected by the resolution of textures. Drawcalls are affected by multi-pass shaders, ammount of non-batching materials on the scene, shadows, post processing effects (bloom, glow, etc) and as a general rule, you pay 2 drawcalls per OnGUI element. Nothing else affects the ammount of drawcalls you pay on each frame, and certainly not texture resolution.