Search Unity

NPOT textures: Unity 3.5.7 vs 4.1.2

Discussion in 'iOS and tvOS' started by ecc83, May 22, 2013.

  1. ecc83

    ecc83

    Joined:
    Nov 23, 2012
    Posts:
    32
    I'm upgrading a project from Unity 3 to Unity 4, and am learning a little about NPOT textures along the way.

    My project features a texture set up as NPOT and clamp mode REPEAT

    Now, have I got this right:

    On Unity 3, under the hood, the texture will be converted to POT, and clamp mode preserved

    On Unity 4, under the hood, the texture is preserved as NPOT but the clamp mode is overridden to CLAMP

    (or at least it looks like that's what's happening - we have a problem in EZGUI where textures are disappearing)

    I get the limitations of mobile GPUs and the desire to implement the best case, but if all this stuff is going on under the hood, why is it not reported? In both cases, the editor information is wrong.
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    not completely true, as it will be done only if no GL_OES_texture_npot nor GL_ARB_texture_non_power_of_two is present
    alas ios misses both of them ;-)
    as for not reported (and no way to preserve clamp mode even if converting to pot is ok) - yeah, i can take that, we should think about some better handling.
    But for now you can simply enforce pot yourself 8)
     
  3. ecc83

    ecc83

    Joined:
    Nov 23, 2012
    Posts:
    32
    I don't understand this - are you saying NPOT textures aren't supported on ES 2.0 iOS? I thought they were - provided wrap mode was CLAMP and no mipmaps?
     
  4. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    oh well, sorry, should have made it more clear.
    npot textures (no mipmaps, and clamp) are supported in core gles2
    those 2 extensions allow npot textures to have more wrap modes and mipmapping.
     
  5. ecc83

    ecc83

    Joined:
    Nov 23, 2012
    Posts:
    32
    ah right, thanks
     
  6. ecc83

    ecc83

    Joined:
    Nov 23, 2012
    Posts:
    32
    Following this up: is there a way to preserve the original 3.5.7 behaviour in 4.x?

    My understanding is that the magic happens at the driver level - extra pixels added to pad the dimensions to POT, and some trickery to make the UV's work.

    For example: I have a NPOT texture which tiles in U, but not in V. In Unity 3.5.7, by whatever means it uses, this Just Works. In 4.x, it won't, and the various "Non Power of 2" import options all scale the texture at the import.. which defeats the point of using NPOT in the first place. Is there any way to preserve the original behaviour, without manually padding the textures?

    Thanks