Home General Discussion

Texture size: Why use 1024x1024, 2048x2048.... and not a 1000x1000, 2000x2000... ?

Hi everyone, i'm new in polycount, and this is my first topic.
First of all, I'm sorry for my english, is not that good  :#, anyway, I was wandering why the standard texture sizes are 512, 1024, 2048...(and so on)? And why not use, say, a 3k texture? Is in video games development unusual to use a texture size different from these standards?
Is it not enough that the texture is a square?

Replies

  • fdfxd2
    Offline / Send Message
    fdfxd2 interpolator
    power of 2 texture sizes calculate faster, or something

    for some reason.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Yes   
    It's all to do with how binary numbers work in hardware

    Eg.
    To double a binary number you move  bits to the left 
    00000001 = 1
    00000010  = 2
    00000100 = 4

    This is significantly faster than actually working  out what 2*2 is in long form because you can literally just flip some switches in memory. 
    That's the speed bit (obviously there's more to it)

    The main thing in terms of graphics is that there's a bunch of GPU stuff that relies on dividing a texture in half over and over again  or works on 2*2 groups of pixels (mipping, filtering, compression, sampling etc). 
    If you have a power of 2 you can guarantee that those operations will work, if not you absolutely cant


  • myclay
    Offline / Send Message
    myclay greentooth
    From Intel;

    Since the release of OpenGL 2.0, developers have the option of using textures without specific dimensions. In the past, these texture sizes were required to be powers of two. However, there are advantages to using textures with power-of-two dimensions.
    • Because interpolation of float numbers can be done very quickly with power-of-two textures, these textures will render faster than ones that are not a power of two. The amount of this difference varies depending upon the GPU, and with modern GPUs this difference may be small, but you can see for yourself using the accompanying application.
    • Non-power-of-two textures waste RAM because they are padded up to the next power-of-two dimension, even though they do not use the entire space.
    • This padding may leave edging artifacts in the resulting image.

    From Nvidia some code on how to Mipmap Non power of 2 Textures;
    http://download.nvidia.com/developer/Papers/2005/NP2_Mipmapping/NP2_Mipmap_Creation.pdf

    "The box filter used for power-of-two textures is generalized into a so-called polyphase filter that changes its filter weights for each texel. Additionally, the support of the filter increases from a 2x2 block of texels to up to 3x3. When a texture happens to have power-of-two dimensions, the algorithm described reduces to the standard algorithm. We recommend the use of the algorithm here for non-power-of-two mipmap construction because use of other algorithms, such as naïve bilinear interpolation, for example, can lead to poor image quality when texture mapping."

    Edit; you can also use non square textures but there too, it can make a lot of sense to stick to the power of 2 textures e.g.  512px*1024px


    The Unreal-engine docs for mobile platforms say that textures need to be a power of 2 but can be non-square (as long as its power of 2).
    Square textures are the most efficient.






  • Denny94
    Thanks, really accurate answers 😀
Sign In or Register to comment.