- Home /
Does Unity Care is a texture is a power of 2?
This have been a topic of debate between my coworkers with no clear answer.
For optimization/performance purposes does UNITY care if a texture is a power of two or not. It seems that it re sizes the texture internally. My opinion is that it does not, but other people I work with think otherwise. It would be nice to get a final answer for this.
Thanks
Answer by dannyskim · Feb 09, 2012 at 07:06 PM
It is possible to use other (non power of two) texture sizes with Unity. Non power of two texture sizes work best when used on GUI Textures, however if used on anything else they will be converted to an uncompressed RGBA 32 bit format. That means they will take up more video memory (compared to PVRT(iOS)/DXT(Desktop) compressed textures), will be slower to load and slower to render (if you are on iOS mode). In general you'll use non power of two sizes only for GUI purposes.
Non power of two texture assets can be scaled up at import time using the Non Power of 2 option in the advanced texture type in the import settings. Unity will scale texture contents as requested, and in the game they will behave just like any other texture, so they can still be compressed and very fast to load.
http://unity3d.com/support/documentation/Manual/Textures.html
So in essence, yes, Unity does care as it will automatically assign properties to the texture unless you override it to do differently. When using a compressed format, you'll see that all textures are scaled automatically to a square power of 2 texture size. With a compressed format, this is done automatically because compression rates typically will only work well with power of 2 sizes. If they are not, they will be practically double the size, which is why this is automatically done for you.
Also, compression and power of 2 sizes can be hardware dependent, as well as the algorithm used (such as PVRTC on iOS). Non Power of Two (NPOT) texture capability can vary, say from the PowerVR chipset in the iPhones to something else on an Android phone.
Power of 2 textures nowadays are typically requested by the Game Engine strictly for mip-mapping purposes. If the texture is not in the dimensions of power of 2, then processing for mip-mapping won't be able to take place.
Ok, so did I understand correctly that Unity can create the texture as a power of two by manually setting it in the editor. And it will behave the same as if it was already a power of 2 externally. And if the setting is not set in the editor it will be converted to the uncompressed format?
From my experience, yes that's how it works. As stated, when you set the Texture Type to advanced, those options show up in the importer. NPOT textures will exhibit the behavior that you stated.
@dannyskim Performance/memory-wise, what's the difference of having a NPOT texture imported using "Nearest POT" versus having the POT version of this texture with blank spaces using tiling & offset to make it look right?
Your answer
Follow this Question
Related Questions
Everything is blurry. 0 Answers
shaders question (3DS Max involved) 0 Answers
2D Texture Depth? (From script) 0 Answers
Import (Plz Help) 1 Answer
Instantiating material due to calling renderer.material during edit mode. 1 Answer