Search Unity

Is there any reason to use power of two sprite textures with newer platforms?

Discussion in 'General Graphics' started by kaarloew, Aug 21, 2019.

  1. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    As the title says, is there any reason to use power of two sprite textures with newer platforms?

    Sprite texture in this context means 2D texture that doesn't have mip maps.

    With newer platforms (e.g. OpenGL ES 3.0, Vulkan, Metal etc.) compressed textures (e.g. ETC2 block size is 4x4) do not have strict power of two width and height limits, so one can easily shed quite bit of texture memory by using NPOT textures for sprites (4096x4096 vs. 3600x2400 assuming that there is unused texture space).
     
    peopleUnity likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    Apart from texture resolutions generally needing to be multiples of the block size, there isn't really a big reason to keep to power of 2 textures. Even with mipmaps, most GPUs these days handle that just fine too. One thing to note is that it'll reduce your build size, but may not reduce your GPU RAM usage as many GPUs still use a power of two texture size's worth of memory to hold NPOT textures in for memory alignment reasons.

    One big caveat is iOS devices. Unity still defaults to using PVRTC on, and that format requires square power of two resolutions. So just make sure you're override the iOS texture format on your sprites to ASTC or ETC2, just know that iOS devices from ~5 years ago (iPhone 5S, iPad Air, iPad Mini 2 & 3) will either be unable to run your application or fallback to using uncompressed textures ... but those devices aren't really supported by Apple anymore either so *shrug*. Technically PVRTC2 fixes all of this, but I've never figured out if Unity supports PVRTC2 or just PVRTC and I haven't worked on an iOS application in a long, long time.
     
    SugoiDev likes this.
  3. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Apple does not support PVRTC2.
     
    bgolus likes this.