I’m trying to use a texture in an exported cube from blender, but the result is the texture being applied to the whole mesh one time, and not for each face.
Left is a GLB from blender, right is a BoxGeometry from three.js
// Textures
const textureLoader = new THREE.TextureLoader();
// const bart = textureLoader.load('./logo_alta.svg');
const crate = textureLoader.load('./crate.png');
crate.flipY = false;
// Models
const loader = new GLTFLoader();
loader.load('./cube.glb', (gltf) => {
gltf.scene.scale.set(0.2, 0.2, 0.2);
gltf.scene.children[0].material.map = crate;
gltf.scene.children[0].material.needsUpdate = true;
scene.add(gltf.scene);
});
const box = new THREE.Mesh(
new THREE.BoxGeometry(0.4, 0.4, 0.4),
new THREE.MeshBasicMaterial({ map: crate })
);
scene.add(box);
box.position.x = 1;
I need to be able to adjust the texture to each face. Is there any way to achieve this?