Texture has UVs but applies as solid color

Hello,

Sorry if this question is duplicated but I’ve been searching online and can’t see to understand whats going on.

After Loading an GLB model I want to replace its original texture to a mesh, problem is that it loads as a solid color; Mesh geometry seems to have the UV values.

What am I doing wrong?

How is the texture being replaced:

loadingManager.onLoad = function () {
            console.log(model);
            let fabricTexture = new THREE.TextureLoader().load('/catalog/fabrics/524843.jpg');
            model.children[2].children[0].material.map= fabricTexture;
          
          
        }

Geometry properties:

Try this:

loadingManager.onLoad = function () {
            console.log(model);
            let fabricTexture = new THREE.TextureLoader().load('/catalog/fabrics/524843.jpg');
            model.children[2].children[0].material.map= fabricTexture;
            model.children[2].children[0].material.map.needsUpdate=true;          
        }

Can you send screen?

@Chaser_Code
Tried with this and same issue:

Also got this new messages

image

Any ideas?

Repeating texture:

loadingManager.onLoad = function () {
            console.log(model);
            let fabricTexture = new THREE.TextureLoader().load('/catalog/fabrics/524843.jpg');
            fabricTexture .wrapS=fabricTexture.wrapT=THREE.RepeatWrapping;            
            model.children[2].children[0].material.map= fabricTexture;
            model.children[2].children[0].material.map.needsUpdate=true;          
        }

@Chaser_Code Thank you for your reply!

Now I can see the texture but it looks like this:

I guess its because isn’t seamless?

here its the original texture file:

Try texture scale:

loadingManager.onLoad = function () {
            console.log(model);
            let fabricTexture = new THREE.TextureLoader().load('/catalog/fabrics/524843.jpg');
            fabricTexture.wrapS=fabricTexture.wrapT=THREE.RepeatWrapping; 
            fabricTexture.repeat.set(0.01,0.01);
            model.children[2].children[0].material.map= fabricTexture;
            model.children[2].children[0].material.map.needsUpdate=true;          
        }

@Chaser_Code This made it work like a charm!

Modified the texture scale to fit my model in a better way.

loadingManager.onLoad = function () {
            console.log(model);
            let fabricTexture = new THREE.TextureLoader().load('/catalog/fabrics/524843.jpg');
            fabricTexture.wrapS=fabricTexture.wrapT=THREE.RepeatWrapping; 
            fabricTexture.repeat.set(0.1,0.1);
            model.children[2].children[0].material.map= fabricTexture;
            model.children[2].children[0].material.map.needsUpdate=true;          
        }
1 Like