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
It's all to do with how binary numbers work in hardware
Eg.
To double a binary number you move bits to the left
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
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.
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.