Non power of 2 textures

Hi
Been going through my textires and noticed many are not power of 2 and some are power of 2 in only 1 direction. Is there a downside using these textures and what are they?Is having one side power of 2 eg (2048x1033)at least better than neither been power of 2 (1047x2033 eg).
Thx

1 Like

Unity compresses the textures into power of 2 on import is this the same as if they were already power of 2 before import and do they function (benefit) same after import as if they were originally power of 2??

Having a texture that’s not a power of two on either axis will be rescaled into a power of two texture on import by default. The benefit of power of two textures is mip maps and compression. Mip maps only work properly on power of two textures, and some texture compression formats only work with power of two textures (and some only on square power of two textures).

5 Likes

No.

–Eric

2 Likes

Functionally there’s no difference between textures that are rescaled by Unity on import or start out as power of two initially, but the texture might not look as nice as if it was scaled by an external application or originally authored at a power of two.

2 Likes

Ah good that’s what i figured was just worried it might not compress so well.Guess i will try rescale the important textures myself. Thx for the input

2 Likes

What about 360 images that are used as a skybox in VR? If I plan to use no mip maps and my original image is of size 10000 x 5000 and I set the Texture Shape to Cube, should I enable or disable the power of two?

Also, which compression formats support NPOT? I’ve read that PVRTC2 does it. In the Texture Importer I can choose PVRTC formats for compression. Are these actually PVRTC2?

Thanks!

Irrelevant for cube map textures, as cubemaps must be power of two regardless of the image format. As such Unity will always produce square power of two textures for cube maps, though if you disable it Unity will not generate a cubemap and instead show an error in the console.

The texture you’re importing is used to generate 6 square face textures of the cube map (hence the name), so the original texture itself is not used for rendering. The actual resolution of the cubemap you want to use depends on the HMD you’re targeting. For example, the Rift & Rift S have a roughly ~90 vertical FOV and a vertical render resolution of ~1600 or ~1770. Basically that means if your cubemap’s resolution is higher than that, you’re wasting resolution. 2048 x 2048 cube maps are more than enough resolution to cover all existing VR HMDs, including the Vive Pro, Index, and even the Pimax (which all have higher resolution displays & render targets, but also wider vertical FOVs than the Oculus). So honestly, using 10000 x 5000 source textures for the skybox is a bit overkill. Even half that will probably produce equally sharp 2k cubemaps.

Ignoring the cubemap related conversation above, basically all images formats (except PVRTC) support non power of two resolutions and only need to be multiples of the format’s block size. So that means multiples of 4x4 for most formats, with some added weirdness for ASTC which seems to support resolutions that don’t necessarily match the block size.

There’s a lot of confusion around PVRTC 2.

Unity does not support PVRTC 2 on any device.

The reason for this is simple. Almost nothing supports it. The PowerVR GPUs in the iPhone 5 through to the iPhone 7 support PVRTC 2, but to the best of my knowledge Apple never chose to support the format in their implementation of OpenGL or Metal for iOS. That means even though the hardware supports it, you cannot use PVRTC 2 on any Apple device. Similarly, all of those PowerVR GPUs support many of the common desktop texture compression formats like DXT1 and DXT5, with the later even supporting the newer BC formats, but Apple similarly chose not to include support for those either. I believe PVRTC 2 is only available on some variants of the Samsung Galaxy S4 (which shipped with different GPUs depending on when / where you bought it!) and a small hand full of generic Android tablets.

Unity’s texture importer has some “PVRTC 2 bits” format options, which many people mistakenly think is for PVRTC 2. But they’re for the original PVRTC in 2 bit per pixel mode (aka high compression mode), not PVRTC 2.

2019.2 docs here Unity - Manual: Importing Textures say: “You can scale up NPOT Texture Assets at import time using the Non Power of 2 option in the Advanced section of the Texture Importer.”
but I can’t find that option.
Do you see it in your Unity?

Does your texture import inspector not look like the one that’s pictured on this page?

If not, maybe you have a different “texture type” selected?

1 Like

you are right - my Texture type is set to Sprite. If I change it to Default - I will get Non Power of 2 in Advanced subfolder.
BUT MY SPRITE RENDERERS WILL NOT RENDER THAT TEXTURE!
What type of texture type shoul I use for 2d game?

For sprites, set the image type back to sprite and pack them into one or more texture atlas:
https://docs.unity3d.com/Manual/class-SpriteAtlas.html
Since the size of the atlas will be a power-of-two that will cover everything.

1 Like