I am new to threejs and have been struggling to add a texture image in my application directory structure.
What am i doing wrong here? Where is the textures dir supposed to be located? how to I go about using images from different directories?
let loader = new THREE.TextureLoader();
let texture = null;
THREE.ImageUtils.crossOrigin = '';
texture = loader.load("textures/4268-bump.jpg")
let material = new THREE.MeshLambertMaterial({color: 0x11BBAA,map: texture});
...
//add to scene
I am was able to put break points and confirm the file is indeed being retrieved but the texture is just colored black.
let loader = new THREE.TextureLoader();
let texture = null;
if (internalPorts && internalPorts.includes(object3d.children[i].name))
{
THREE.ImageUtils.crossOrigin = '';
texture = loader.load(textureImg);
texture.name = object3d.children[i].name;
}
After reducing the size of the image to 16x16 I was able to get an image, but the image does not fit the containing object. Would you happen to know how I could achieve that?