Difference between revisions of "NPOT Textures"

From Verge3D Wiki
Jump to navigationJump to search
(NPOT textures explanation)
 
Line 34: Line 34:
* 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).


So the general idea behind all these:
So the general idea behind all these:


'''Do not use NPOT texture in Verge3D applications!'''
'''Do not use NPOT textures in Verge3D applications!'''

Revision as of 09:20, 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 texture 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. As such, all such textures will be resized to nearest power-of-two dimensions. This will result to:

  • Increased app loading time, because texture convertion takes time.
  • More memory consumption.
  • Reduced texture quality.

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:

Do not use NPOT textures in Verge3D applications!