Reputation: 21
I discovered Three.js recently and started playing with it, I'm trying to programmatically apply a texture to a GLTF2 Mesh that I designed in blender, it works but the texture isn't displaying like it should.
My code (working)
document.addEventListener('click', () => {
let texture = textureLoader.load( './gagency.jpg' );
texture.center.set(0.5, 0.5)
let material = new THREE.MeshBasicMaterial( { map: texture } );
meshLaptop.children[2].material = material; //the screen of the 3d laptop
})
The texture I'm trying to apply
The result
I tried to redo the uv mapping of the plane mesh in blender but the problem doesn't seems to be related to that.
Thank you for taking the time to read my issue, I hope someone have already been in my situation and found a solution, if you need more code or screenshot feel free to ask.
Upvotes: 1
Views: 150
Reputation: 21
New answer : after more tests I found that the problem was indeed the UV mapping of the screen that wasn't correctly reloaded in my browser, if something similar append to you clean up the UV map and you'll be good to go
Old answer : I didn't change anything and the problem is gone after some cache clearing, I still don't know what was causing the issue because I already tried to empty my browser cache before posting my question and it didn't do anything, but it is fixed now
Upvotes: 0