Difference between revisions of "NPOT Textures"
m (→WebGL 2.0) |
m (add category) |
||
Line 1: | Line 1: | ||
[[Category:Rendering]] | |||
An NPOT texture is a texture whose dimensions are not powers of 2 (hence the name — '''N'''on-'''P'''ower-'''O'''f-'''T'''wo). | An NPOT texture is a texture whose dimensions are not powers of 2 (hence the name — '''N'''on-'''P'''ower-'''O'''f-'''T'''wo). | ||
Revision as of 13:09, 30 October 2021
An NPOT texture is a texture whose dimensions are not powers of 2 (hence the name — Non-Power-Of-Two).
For example, the following textures are NPOT:
- 1000x500
- 1200x800
- 1920x1080
- 500x1
And these are POT (power-of-two):
- 512x512
- 2048x1024
- 4096x4096
- 128x1
So, POT textures must have the sizes from the following list: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, etc.
Why NPOT textures are bad for real-time 3D?
WebGL 1.0
Older hardware/browsers, which support only WebGL 1.0 standard, do not handle NPOT textures well. For example, you can't use advanced filtering on them. Hence, all such textures will be resized to nearest power-of-two dimensions (e.g 1000x1000 will become 1024x1024). This will result to:
- Increased app loading time, because texture conversion takes time.
- More memory consumption.
- Reduced texture quality.
- Wasted texture space as the image is re-scaled by Verge3D to get the closest POT texture.
WebGL 2.0
Newer hardware/browsers do support NPOT textures, however it's still not recommended to use them:
- NPOT textures occupy more GPU memory.
- Rendering of NPOT textures might be significantly slower (on some devices).
- There might be visible texture filtering artifacts (on some devices).
So the general idea behind all these:
Avoid using NPOT textures in Verge3D applications!