Hello, in the below codes, I imported object and material from Marvelous designer and I can use them. Now I want add texture(.jpg file) over that mateerial and object. How can I do that? const objLoader = new THREE.OBJLoader();
const mtlLoader = new THREE.MTLLoader();
mtlLoader.setMaterialOptions({side:THREE.DoubleSide});
//loaded material here
mtlLoader.load( 'mrv_shirt6.mtl', function( materials ) {
materials.preload();
//loaded object here
objLoader.setMaterials( materials );
objLoader.load( 'mrv_shirt6.obj', function ( object ) {
object.position.set( 0, -4.2, 0 );
scene.add( object );
},
// onProgress callback
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
function ( err ) {
console.log( 'An error happened' );
});
});
function render(){
requestAnimationFrame(render);
renderer.render(scene,camera);
}
As you can see, I use an imported material and object. Now I want to cover that material and object with my custom texture which is .jpg file. How can I achieve this?
Thanks
The above code made change on the color of the material or object BUT I can not see any pattern change, I mean I can not see pattern of the texture over the object. I only see main color of texture is applied to object. SO for example object turns into red, or blue or pink. BUT no pattern or texture only mono-color change.
Looking for your ideas
Thanks
Hey, thanks for response. How can I be sure about that? Can you show me a document or something about that. I just have simple shirt object which is created on Marvelous designer. THen I exported that object in the form of .obj. And Threeejs can render the object and material that I can see them on the scene BUT I dont know how to be sure about it have valid geometry or not.
Secondly if it doesnt have a valid geometry is there any thing that I can apply? Such as transforming my object geometry into something else? Any idea will be appreciated since I am totaly newbie to threejs and 3d world. Thanks
Hello, there is an improvement from the SO part. Someone offered there may be a problem with UVs of the object. I dont know what is UV but I realized that there is a section “Concatanated UV Coordinates”, I made a try with these preference selected. ANd now a quarter part of the object shows texture. Interestingly only lower right quarter part shows the correct texture. I am sharing the image that show the correct texture: https://imggmi.com/view/2019/2/18/265d47d674b3bcb9fb5d3f9aa79b54f5-full.png.html So I can see that only one quarter of the object shows correct texture. Any ides will be appreciated. Thanks