Few questions about mipmap

  1. Textures use mipmap by default. But do I need image files with power of 2 dimensions? Does it need to be square (1024x1024)? Can it be rectangular as well (1024x512)?

  2. If I use a texture atlas (large image file containing multiple textures), do I need the atlas file with PoT dimensions? Or do I need the individual textures with PoT dimensions? Both?

  3. If I manipulate uOffset, vOffset, uScale, vScale of a Texture, is Babylon.js smart enough to correctly use mipmapping?

  4. Why is mipmapping not used in GUI?

Hey!

  1. It can be rectangular. BJS will make it work even on weblg1 by rescaling textures for you
  2. none :slight_smile:
  3. of course :wink:
  4. GUI is using canvas2D not webgl
1 Like

Hello your majesty :slightly_smiling_face:

Sorry I don’t understand, how can 2 be none, if I need rectangular PoT for 1?

Cause Babylon will rescale for you under the hood so it should not impact you to use NPOT

1 Like

So I don’t need PoT images for both cases (1 and 2)?

In other words, I can always use NPoT images and BJS will still be able to use mipmapping.

1 Like

yes sir!

Does it depend on the platform, browser, or WebGL version?

Babylon.js will check the system capabilities and will provide fallbacks if required so it is transparent for you

@Deltakosh

If I understand correctly, if the current system does not support NPoT textures, BJS will convert them to PoT textures under the hood.

getSize will return the original size of the Texture.

getBaseSize will return the PoT converted size of the Texture.

Am I correct?

I think so :wink: (but maybe the opposite like getBaseSize will return the original)

:confused:

The documentation does not clearly say which 1 is which, it only says that they may give different values…

getBaseSize will return the PoT size if a conversion occurred.

2 Likes

Is there any way to force BJS to use PoT textures? So that NPoT textures will be converted to PoT.

Any settings I can use to achieve this in playground?

Even if not required you mean? Why that?

For testing purpose.

I am using a texture sheet and manipulating uOffset, vOffset, uScale, vScale to show individual textures. After loading the texture sheet I get the size of it by using getSize method, then calculate the offset and scale values using the size.

I am not sure if my calculations will work correctly if the textures are converted to PoT.

No worries it will be…Just try :slight_smile:

I already know that it works if the textures are NOT converted to PoT.

I am just afraid that it may not work correctly if the textures are converted to PoT.

Hence why I want to test under the condition that all textures are converted to PoT.

You can force the engine to run on webgl1 then (EngineOptions - Babylon.js Documentation)

1 Like