Back to Main Page

A page about texture sizes and the importance of them being correct.


Texture Sizes - Why Power of Two is King (and essential)

I was browsing a-n-other mod site today and noticed a comment on a car I had downloaded recently. It mentioned NPOT textures, NPOT = Not Power Of Two.

A POT (Power Of Two) texture doesn't mean a texture that is square, it means a texture where width and height are at power-of-two resolutions. 2, 4, 8... 128, 256, 512, 1024, 2048 etc... you can see the pattern, take the previous value and multiply by two. These values don't have to match, 2048x128 is still a POT texture

Who cares? It's just a size... right?

Well many years ago, the GPU used to care a lot, in fact some GPUs cared that much, they wouldn't work with NPOT textures at all. Since around 2006, GPUs have cared a little bit less, because they have been given the power to handle these textures a bit more effectively. That doesn't mean there is no longer a problem, it means there is less of a problem but the problem is still present.

There are a collection of problems related with NPOT textures:

1) Texture Memory Space

While GPUs will read and work with NPOT textures from resources, in VRAM, POT textures still get created. POT aligned memory is faster to work with, which is essential when you are generating MIPMAPS, which are based on half the texture size at each subsequent MIPMAP level. The important thing to remember, is that NPOT values are never just over POT values, they are always below preferred values.

So a 520x520 texture isn't a little bit over 512x512, it's a lot under 1024x1024 and when that texture gets decompressed into memory, a 1024x1024 texture's worth of memory usage is what you're going to get. That's almost 4 times the texture space that gets used, or three 512x512 textures that could have used that space instead. NPOT textures are wasteful and wasteful is never a good thing. Consider a 4100x4100 texture, that will get scaled to 8192x8192... there's an 8K texture's worth of space gone in an instant... 8K for an extra 4 pixels over the POT boundary.

2) Wasted Processing Time

If you provide a NPOT texture, at some point, your GPU is going to have to create a POT version of it. Regardless of how fast this happens, it happens. Every bit of time your GPU is sat there thinking "FFS! Not another NPOT texture that needs adjusting", is time it could be rendering something useful instead. So be GPU friendly and in return, it will give you 100% performance, maybe.

3) Tiled UV Coords

If you're lucky, your NPOT texture will get scaled to fill the POT texture but what if it doesn't? If you've decided that you're going to use that 250x200 texture on a tiled surface, what's going to happen? Tiled UVs rely on being able to wrap on the 0.0 or 1.0 boundaries**. So your 250x200 texture gets scaled up to 256x204.8 and then gets padded with blank space around the shorter sides. But because your UV coords still wrap from 0.0 to 1.0, that blank space is now part of your texture. Not only that but it's part of the MIPMAPS that are created from that texture. Remember, the bottom of your texture is always 1.0, the right of your texture is always 1.0 and the next coordinate wrapped UVs expect to find, is 0.0.

If you're lucky, you might get your texture scaled to 256x256 but that then leaves you with texture details that are not universally scaled. It also could leave you with filtering artefacts in the mipmaps because of the scaling algorithm.

Model Sources

If you get a model from a rendering site, like Hum3D, they probably won't care what size the textures are because photo-realistic rendering engines don't care. They don't have to manage textures for real-time rendering, so it just won't matter. 900x900, 1300x1300 any size will be possible. But if you get a model from those sites, then your responsibility is to the people who are going to use your mod. "That's how the model came from the site" is not a valid argument, because it is you that applied those textures to the converted model... you're responsible for the model that appears in the game.

If you get a model from another game, like NFS or the Forza games, then there is a very high chance that all the textures are going to be 100% correct size-wise. If that's the case, then whatever you add also has to be 100% correct. Professional game modellers have created those models and they tend to know what they are doing... most of the time. As much as some of the GTA V textures are poor quality, they're still the right sizes. Professionals do things right for a reason, learn from them and follow their lead.

** UV Texture coordinates are based on a 0.0 to 1.0 coordinate system that is independent of resolution. This is why you can replace any texture with one of a greater or lesser resolution and the UV coordinates remain intact... as long as the aspect ratio of the texture is equal. Left and Top are always 0.0, Right and Bottom is always 1.0