Hello everybody… I searched a lot before opening this topic…
My process is next:
I download stl file, using online converters i convert it to obj, if Im using default OBJ file from tutorial, texture is applied, but with mine: no.
Working file: https://inaf.ba/eldin-aquabalkan/avion.obj
Not working file: https://inaf.ba/eldin-aquabalkan/macaron.obj
this is how i tried to load model
function onModelLoaded() {
object.traverse( function ( child ) {
let mat = new THREE.MeshPhongMaterial( { color: 0x171511, specular: 0xD0CBC7, shininess: 5, flatShading: true } );
const texture = new THREE.TextureLoader().load( 'https://inaf.ba/eldin-aquabalkan/media/site/7df2d4cd5a-1643637763/slider-1.jpg' );
const material = new THREE.MeshBasicMaterial( { map: texture } );
child.material = material;
});
setupAnimation(object);
}
and version 2
function onModelLoaded() {
object.traverse( function ( child ) {
let mat = new THREE.MeshPhongMaterial( { color: 0x171511, specular: 0xD0CBC7, shininess: 5, flatShading: true } );
const texture = new THREE.TextureLoader().load( 'https://inaf.ba/eldin-aquabalkan/media/site/7df2d4cd5a-1643637763/slider-1.jpg' );
const material = new THREE.MeshBasicMaterial( { map: texture } );
if (child instanceof THREE.Mesh) {
for ( var i = 0; i < child.material.length; i ++ ) {
child.material[i].map = material;
}
}
});
setupAnimation(object);
}
Thanks in advance