Difference between revisions of "NPOT Textures"
(NPOT textures explanation) |
m (→WebGL 2.0) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Rendering]]{{#seo: | |||
|description=In this article we explain what NPOT textures are, and why you should avoid them in your 3D scenes. | |||
|keywords=Verge3D, Texture, NPOT, 3D, OpenGL, WebGL, 3DWeb | |||
|image=npot_social.png | |||
}} | |||
[[File:npot_social.png|right|thumb]] | |||
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). | ||
Line 17: | Line 23: | ||
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. | 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 | == Why NPOT textures are bad for real-time 3D? == | ||
=== WebGL 1.0 === | === 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. | 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 | * Increased app loading time, because texture conversion takes time. | ||
* More memory consumption. | * More memory consumption. | ||
* Reduced texture quality. | * Reduced texture quality. | ||
* Wasted texture space as the image is re-scaled by Verge3D to get the closest POT texture. | |||
=== WebGL 2.0 === | === WebGL 2.0 === | ||
Newer hardware/browsers do support NPOT textures, however it's still not recommended to use them: | Newer hardware/browsers '''do''' support NPOT textures, however it's still not recommended to use them: | ||
* NPOT textures occupy more GPU memory. | * NPOT textures occupy more GPU memory. | ||
* Rendering of NPOT textures might be significantly slower (on some devices). | * Rendering of NPOT textures might be significantly slower (on some devices). | ||
* There might be visible texture filtering artifacts (on some devices). | * There might be visible texture filtering artifacts (on some devices). | ||
* NPOT textures cannot be compressed. | |||
So the general idea behind all these: | So the general idea behind all these: | ||
''' | '''Avoid using NPOT textures in Verge3D applications!''' |
Latest revision as of 12:31, 18 May 2022
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).
- NPOT textures cannot be compressed.
So the general idea behind all these:
Avoid using NPOT textures in Verge3D applications!