Textures only map if not rendered first

I call about 30 TextureLoader()'s, and set the ‘on load’ callback to map the resultant texture to an object in my scene.

Weirdly, this only works if I don’t LOOK at the objects first. If I look at the object, it seems to cache to a blank texture. If I just give it a second to load the texture, fine.

Am I missing something basic here?

Basically I add the object with no texture, and in the “on load” callback, I call “mesh.map = texture”

Can you please try to add the texture directly to the object like so:

mesh.material.map = textureLoader.load( 'path/to/my/texture.jpg' );

When the texture is loaded, its contents are automatically updated by three.js.

BTW: mesh.map is wrong. The Mesh class has no property map.

2 Likes

ty! I had too many moving parts there, it’s simpler than I thought…