Hello
I’m pretty new to Three.js and I’ve been looking a while to solve a problem I’m having:
I have a custom .obj model and I would like to place any texture on it, in this case just a wooden texture. The problem however is that the texture doesn’t seem to fix nicely on the object, but it does kinda color the object. I’ve tried scaling down the texture but that doesn’t really help.
I’m sure somebody has asked this question before, but I haven’t found an anwser yet, so any help would be lovely
Texture:
Result:
Here is my code:
`var loader = new THREE.OBJLoader();
loader.load( ‘assets/img/child_with_goose.obj’, function ( geometry ) {
var textureLoader = new THREE.TextureLoader();
var texture = textureLoader.load( ‘assets/img/materials/taco_difuse.jpg’ );
var material = new THREE.MeshStandardMaterial();
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
material.metalness = 0;
material.map = texture;
geometry.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material = material;
}
} );
geometry.scale.x = 0.0015;
geometry.scale.y = 0.0015;
geometry.scale.z = 0.0015;
geometry.position.y = -0.6;
scene.add(geometry);
} );`
Thanks in advance.