Beginner: How do I export this multi file as one .obj with the materials intact?

Beginner: How do I export this multi file as one .obj with the materials intact?

julia.leclair
Observer Observer
1,447 Views
4 Replies
Message 1 of 5

Beginner: How do I export this multi file as one .obj with the materials intact?

julia.leclair
Observer
Observer

As a part of a project I 3D scanned all these objects to combine them all into one single 3D object, but whenever I try to export it will take the material of one object and stretch it over all the others. I wanted to know if there is a way that I can keep the original textures of each individual, but export it as one solid object? Or is this just a huge ask and not possible? Thanks.

 

 

0 Likes
Accepted solutions (1)
1,448 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution

Yes, that's a limitation of MM happening on combined textures...

You need to make sure that your source obj>mtl>image bundles do not use the same material:

 

Let's say there are just two source obj>mtl>image bundles each using a single texture:

  • First A.obj says: "usemtl Material1" and A.mtl says: "newmtl Material1 ./ map_Kd Image1.bmp"
  • Second B.obj says: "usemtl Material1" and B.mtl says "newmtl Material1 ./ map_Kd Image2.bmp"

means both objects use one material: Material1. No problem as long as these are separate objects. But if you write the files to one combined obj MM merges the materials too and uses one image only.

 

Instead if

  • First A.obj says: "usemtl Material1" and A.mtl says: "newmtl Material1 ./ map_Kd Image1.bmp"
  • Second B.obj says: "usemtl Material2" and B.mtl says "newmtl Material2 ./ map_Kd Image2.bmp"

means there are different materials and MM can keep the different textures in a combined file.

 

So you need to open one obj file in a text editor and change the line "usemtl Material1" to "usemtl Material2"

AND the corresponding .mtl's line "newmtl Material1" to "newmtl Material2"

Could be easier, but that's life...

0 Likes
Message 3 of 5

julia.leclair
Observer
Observer

Thank you so much! & how would I open the text editor? 

 

So sorry just completely new to this. 

 

Update: I figured out what you meant and opened it in Sublime Text and it completely worked!! 

Now begs the question if i have to re-position my old project or can i use the updated files even through they were already imported before i did the change. 

 

Thanks again!

0 Likes
Message 4 of 5

Anonymous
Not applicable

In case you did import files before changing equal materials I would try to change the links after an export to a single file.

If you export a scene (using different textures linked to the same material) as one combined object MM writes a combined .obj, a .mtl file and a single texture image.

First thing to do is to copy all the missing source textures to the combined output's directory and maybe you rename the images in a meaningful way.

Now open the output .obj in a text editor. The shown example file is made of only four triangle faces for each part. So your file should be much longer.. Use the editor's Search and Replace functionality.

You'll find several usemtl Material0 ( Material0 might be different) lines splitting the lines starting with "f" (Faces). All f-lines below such a usemtl-line use the material until a next usemtl-line.

Change Material0 to ascending Material0, Material1, Material2, Material3... so there are no duplicated lines any more and save

Ohne Titel 10.jpeg

Now open the .mtl and change the material names and the linked image name (and maybe format). Material0 should be ok. Ignore the NO_Material. This is just used for regions where no texture coordinates exist.

The problem might be to find the right image for the very part. The order should be the same as you added the partial objects to the scene (not sure)...

Ohne Titel 12.jpeg

0 Likes
Message 5 of 5

Anonymous
Not applicable
So sorry, there's a mistake in the lower image. The lower red arrow's end should be "newmtl Material2"
0 Likes