Print at Dec 17, 2025, 4:32:36 AM View all posts in this thread on one page
Posted by marianooshiro at May 9, 2017, 12:21:54 PM
importing mtl file
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?

Posted by Puybaret at May 10, 2017, 8:25:20 AM
Re: importing mtl file
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

Posted by dani191234 at May 24, 2017, 7:09:06 PM
Re: importing mtl file
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.

Posted by bdfd at May 25, 2017, 6:10:58 AM
Re: importing mtl file
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.

smile
----------------------------------------
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K

Posted by dani191234 at May 25, 2017, 1:42:03 PM
confused   Re: importing mtl file
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?

Posted by okh at May 25, 2017, 1:55:30 PM
Re: importing mtl file
No wavefront expert, but in the few lines of .obj file you quote, there is no usemtl (material name) 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_.obj_file#Referencing_materials

Could that be the reason?

ok

Posted by bdfd at May 25, 2017, 3:45:03 PM
Re: importing mtl file
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)

smile
----------------------------------------
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K

Posted by dani191234 at May 26, 2017, 8:23:31 PM
Re: importing mtl file
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 biggrin

Posted by bdfd at May 27, 2017, 6:06:50 AM
Re: importing mtl file
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 biggrin
Hi,

Very Strange ! sad

Can you put the file to us download it ?

smile
----------------------------------------
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K