Material texture stretched on loaded OBJ file

I have a sofa OBJ file , that contains multiple part, the first part is biggest part of sofa and I want to tile it with a fabric image. everything is fine except that fabric stretched on sofa main part, even when I change U and V scale it behaves ugly,
when scale is : 10, 10

and when scale is: 10, 1

and last scale: 1, 10

and this is my code when I set texture on loaded mesh:

var mat = new BABYLON.StandardMaterial("Material", scene);
var texture = new BABYLON.Texture(IMAGE_URL, scene);
mat.diffuseTexture = texture;
texture.uScale = scaleU;
texture.vScale = scaleV;
mesh.material = mat;

I just want to tile it, It should be so simple but I’m beginner
This is the fabric:
161

and this is sofa:
sofa1.zip (83.8 KB)

Hi. You need unwrap your model in one texture uv tile (UDIM). I think now you unwrap as box and this creates problems because the unwrap has gone beyond one udim. For few udims i think you need uv offset but not in your case. You need simply unwrap possible with overlaps. But if you plan bake lightmaps or ambient occlusion you need unwrap without overlaps.

Thanks for response, But I really don’t know what are you talking about? I’m beginner in Babylon, Can you make a Playground for it, I upload required assets in question.

As @kvass says the UV map for the mesh is all over the place (images below)

I download your object mesh and viewed it in Blender 2.90. I divided it up into sections 1.) long section going Up/Down. 2.) long section going Left/Right.

Image 1 : is for the seat part and shows the selection part 1 - not selected in the UV area, part2 -selected in the UV area(orange colour). Part 1 has a basic “box” uvmap, part 2 not a box map and very much smaller than part 1.

Image 2 : is for the backs again part 1 is not selected in UV area, part2 is selected(orange)… Again a huge difference in size of the two sections and worse the part2 piece is just a straight line of vertices. Mind you part 1 has a straight line of vertices too.

The UV mapping is a mess - no amount of adjusting the UVScales is going to solve the issue. You need to unwrap the mesh properly.

Stay Safe All, gryff :slight_smile:

The seat parts:


The back parts:

1 Like

Hey. Its not Babylon question and you cant unwrap something in playground. You need search instructions for your DCC something like this for 3ds max https://m.youtube.com/watch?v=Xl362HHWXtE
There example of one udim

Thank you so much @gryff , I get it. I will unwrap parts then import and texture each part seperately.
But It will be good if Babylon add something to tile whole mesh with image.

Thank you @kvasss and sorry for my laziness :slight_smile:
I have to work more with blender and get familiar with 3D expressions.
Can you give me a suggestion?
Which way do you prefer to add object in scene?
1- Textureless objects then texture it babylon
2- Objects with texture like gltf files
If you have other solutions would be appreciated

Model->unwrap->texture->export->use