2
votes

I am loading an obj + mtl model in three.js scene.

In mtl file I have three materials defined, all of them with jpg files as textures.

When I load the model, it works fine, but when I inspect childs (looking child.material.map.image), one of these materials loads the texture as jpg file and other two loads textures as canvas elements.

I need to force to load all textures as jpg file in child.material.map.image, and prevent to load these as canvas element.

Is there any way to avoid that three.js creates canvas elements to work with loaded textures and force it to load jpg file?

Thanks in advance.

1

1 Answers

1
votes

The THREE.MTLLoader.ensurePowerOfTwo_ function creates a canvas element if the texture width or height is not power of two. (It resizes the image with a canvas.)

I think that one of your textures has power of two width and height, but the other two has not.