Difference between revisions of "NPOT Textures"

From Verge3D Wiki
Jump to navigationJump to search
Line 17: Line 17:
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 texture are bad for real-time 3D? ==
== Why NPOT textures are bad for real-time 3D? ==


=== WebGL 1.0 ===
=== WebGL 1.0 ===
Line 23: Line 23:
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:
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 convertion takes time.
* Increased app loading time, because texture conversion takes time.
* More memory consumption.
* More memory consumption.
* Reduced texture quality.
* Reduced texture quality.
* Цasted texture space as the image is re-scaled by Verge3D to get the closest POT texture.


=== WebGL 2.0 ===
=== WebGL 2.0 ===

Revision as of 09:35, 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.
  • Цasted 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!