Know the displayed resolution

Hello,
I am trying to know if it is possible to know the resolution of a texture because sometimes my textures are resized (THREE.WebGLRenderer: Texture has been resized from (10000x5000) to (8192x4096) )? Maybe, there is a field in textures but I don’t find it :confused:

Thanks you in advance,

Alex

Textures have an image property that contains the textures’s dimensions (width and height). Keep in mind that you can first access this property when the texture has fully loaded (so when the onLoad() callback fires).

2 Likes

BTW: When a texture is resized, the original image is not changed since the resize happens with an internal canvas element in the renderer. So it’s not possible to access the resized dimensions of a texture. Use POT textures or set Texture.minFilter to THREE.LinearFilter to avoid the resize. Or use a WebGL 2 rendering context.

3 Likes

Thanks for the reply, it’s really helpful and allow me to gain some precious research time !