importing mtl file

This topic has been viewed 11028 times and has 8 replies
Thread status: Active
How can I do this? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
marianooshiro
Posts: 1
Joined: Mon Apr 24, 2017 5:34 pm
Country: Argentina

importing mtl file

Post by marianooshiro »

I have obj and mtl files in the same folder. when I try to import both files, it seems sweethome only takes obj file. the couch appears in the library, but with no colors and texture its meant to be. it seems sweethome doesn´t recognize the mtl file.

¿can anybody help me?
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: importing mtl file

Post by Puybaret »

It's difficult to help without the OBJ and MTL files. Could you edit the OBJ file with a text editor and write here the line which starts by "mtllib"? Did you use some texture images?
Emmanuel Puybaret, Sweet Home 3D creator
dani191234
Posts: 3
Joined: Wed May 24, 2017 6:17 pm

Re: importing mtl file

Post by dani191234 »

I have the same issues with my files I downloaded from https://www.cgtrader.com. I am not able to find the exact link but here are some code-snippets (I hope they are helpful). Here are the first lines of my obj.file which has more than 19.000 lines and 13MB (it's a tree).
mtllib OC12_1.mtl
# object OC12_1
g OC12_1
v -0.01253 -0.00193 0.00455
v -0.00879 -0.00551 0.01153
v -0.00093 -0.00652 0.01508
v 0.00737 -0.00449 0.01356
v 0.01224 -0.00036 0.00766
v 0.01139 0.00392 0.00015
v 0.00522 0.00636 -0.00546
v -0.00338 0.00581 -0.00654
v -0.01039 0.00254 -0.00259
v -0.01335 -0.00310 0.00381
v -0.00938 -0.00681 0.01131
v -0.00100 -0.00783 0.01514


and here is my mtl-file:
newmtl ROOTS2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12brk2.tif
map_bump
bump
map_opacity
map_d
refl
map_kS
map_kA
map_Ns

newmtl TRUNK2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12brk2.tif
map_bump
bump
map_opacity
map_d
refl
map_kS
map_kA
map_Ns

newmtl BARK2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12brk2.tif
map_bump
bump
map_opacity
map_d
refl
map_kS
map_kA
map_Ns

newmtl TWIG2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12brk2.tif
map_bump
bump
map_opacity
map_d
refl
map_kS
map_kA
map_Ns

newmtl LEAF2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12lef2.tif
map_bump
bump
map_opacity
map_d
refl
map_kS
map_kA
map_Ns


I also have several tif-files. Both mtl- and obj-files are in the same zip-folder when importing, but colors are not imported.

Please help me :)
Thanks in advance.
User avatar
bdfd
Posts: 2614
Joined: Sat Mar 29, 2014 7:17 am
Country: LILLE, Les Hauts de France, Western Europa

Re: importing mtl file

Post by bdfd »

I have the same issues with my files I downloaded from https://www.cgtrader.com. I am not able to find the exact link but here are some code-snippets (I hope they are helpful). Here are the first lines of my obj.file which has more than 19.000 lines and 13MB (it's a tree).
...
and here is my mtl-file:
newmtl ROOTS2
Ka 0.1 0.1 0.1
Kd 1 1 1
Ks 0 0 0
illum 2
Ns 2
map_Kd OC12brk2.tif
map_bump
...

I also have several tif-files. Both mtl- and obj-files are in the same zip-folder when importing, but colors are not imported.
Please help me :)
Thanks in advance.
Hi,

I think that tif format is the problem.
Try to transform them in jpg and try again.

[:)]
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K
dani191234
Posts: 3
Joined: Wed May 24, 2017 6:17 pm

Re: importing mtl file

Post by dani191234 »

Hi, thanks for your reply.

I transformed every tif to jpg but still the same problem that colors are not imported. I now tried several files and I am confused because for some the colors are imported and for some they are not. But I can not figure out what the difference between these files are.

Is there anything I should pay attention to when downloading files?
okh
Posts: 1545
Joined: Sun May 12, 2013 9:43 pm

Re: importing mtl file

Post by okh »

No wavefront expert, but in the few lines of .obj file you quote, there is no [font=courier new]usemtl (material name)[/font] which I believe is the link between the group in the .obj file and corresponding material in the .mtl file.

https://en.wikipedia.org/wiki/Wavefront ... _materials

Could that be the reason?

ok
User avatar
bdfd
Posts: 2614
Joined: Sat Mar 29, 2014 7:17 am
Country: LILLE, Les Hauts de France, Western Europa

Re: importing mtl file

Post by bdfd »

Hi, thanks for your reply.
I transformed every tif to jpg but still the same problem that colors are not imported. I now tried several files and I am confused because for some the colors are imported and for some they are not. But I can not figure out what the difference between these files are.
Is there anything I should pay attention to when downloading files?
Hi,

@okh, well seen !

Here is an example :
Name of the object = object

The zipped package contains 3 objects (made recently) :
object.mtl
object.obj
object_cylinder.jpeg

The beginning of the 'object.obj' is like this :
#
# Generated by Sweet Home 3D - ven. mai 19 15:08:29 CEST 2017
# http://www.sweethome3d.com/
#
mtllib object.mtl
g cylinder_1
usemtl cylinder
v 0.0000004 240.00002 -15.000001
...

The beginning of the 'object.mtl' is like this :
#
# Generated by Sweet Home 3D - ven. mai 19 15:08:29 CEST 2017
# http://www.sweethome3d.com/
#

newmtl cylinder
illum 1
Ka 0.2 0.2 0.2
Kd 1.0 1.0 1.0
Ks 0.0 0.0 0.0
Ns 1.0
map_Kd object_cylinder.jpeg

The name of the used texture is :
object_cylinder.jpeg (or jpg)

[:)]
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K
dani191234
Posts: 3
Joined: Wed May 24, 2017 6:17 pm

Re: importing mtl file

Post by dani191234 »

I checked the files again and the "usemtl ROOTS2" is included. I also changed the path to the new jpg-files in the mtl-file.
Still not working.

But anyway thank you so much for your help and tips [:D]
User avatar
bdfd
Posts: 2614
Joined: Sat Mar 29, 2014 7:17 am
Country: LILLE, Les Hauts de France, Western Europa

Re: importing mtl file

Post by bdfd »

I checked the files again and the "usemtl ROOTS2" is included. I also changed the path to the new jpg-files in the mtl-file.
Still not working.
But anyway thank you so much for your help and tips [:D]
Hi,

Very Strange ! [:(]

Can you put the file to us download it ?

[:)]
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests