Question

OBJ reader does not read MTL


Hello,

 

When I inspect/read a OBJ file, the associated MTL file is not used (aka my objects are not textured).

 

My OBJ and MTL files are both generated by Blender and their format seems correct.

 

Thanks.


12 replies

Userlevel 3
Badge +13

Hello @0x974​, sorry to hear you're having issues seeing your textured model in FME. Would you be able to share your OBJ and MTL files here? Also, what version of FME are you using? Happy to help, Kailin.

Of course, please see enclosed!

 

In Blender:

buildings-blender 

In FME:

buildings-fme 

Thanks.

Maybe the reason is that I don't know how to tell FME to use the MTL file.

It is automatic with Blender.

Userlevel 3
Badge +13

Maybe the reason is that I don't know how to tell FME to use the MTL file.

It is automatic with Blender.

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Dear @kailinatsafe​, please find attached the texture/ folder. After deleting the absolute part of the paths in the MTL file and keeping the relative part, you should unfortunately see that it won't work better.

Userlevel 3
Badge +13

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @0x974​, thanks for responding! I've removed the path in my original response, sorry about that!

 

Hm... I think you should take another look at the paths in the MTL file. With the data you just provided (Textures.obj) I am able to read with textures, you've set the MTL path up correctly:

 

image 

Regarding the original dataset, I copied the other "texture" folder (for the buildings) into the buildings folder I originally downloaded from you, and updated some (note: not all) of the map_Kd paths in the MTL file. An example map_kd path for your building textures would be:

 

map_Kd /texture/baked_cc0textures_bricks11_col_exp.jpg_ede8e8_pro_6908_exp.png

 

After saving the MTL file, I can see textured objects in FME:

 

image 

If I were to update all the paths in the MTL file, I suspect we would see each building textured. Please take another look and let me know if you're still stuck. Best, Kailin.

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Dear @kailinatsafe​, so it's very strange because from my side, I still see no building textured (but all are in Blender). Do you have a special procedure to import the MTL too?

 

What I did here is just open the OBJ file in FME Inspector.

Userlevel 3
Badge +13

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @0x974​, there is no special procedure for having FME pickup the MTL file, the relative paths in the MTL should be enough to texture your objects. What version of FME are you using? Sorry we're struggling here!

 

Can you try downloading/reading the new zip attached to this response? I've taken some time now to update almost all the paths in the buildings.mtl file.

 

I am still missing some images that are not in 'texture' folder, therefore not all of the buildings were textured (for example: t_0038_exp.jpg is missing). Hopefully this is enough to get you started / use as an example

 

image 

Happy to help, Kailin.

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @kailinatsafe​,

 

Thank you for your time. I tried again and it does work as expected.

 

I don't understand why it did not work last time I changed the paths; it was certainly my fault.

 

Also, I don't understand why it always worked with Blender. I just triple checked and I can confirm that original absolute texture paths do exist on my filesystem.

 

OBJ and MTL files are exported with Blender. If I want to import them in FME, how can I do? Should I have to manually edit texture paths in the MTL file?

 

Thanks again so much for your assistance.

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

(btw, it would help if FME could show a warning somewhere when a linked texture file is not found)

Userlevel 3
Badge +13

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @0x974​, can you confirm the PNG's are in those path locations? If so, not totally sure why FME cannot pick them up. Nonetheless, thank you for the update! I'll pass the suggestion along! Happy to help, Kailin.

Hello @0x974​, hey thanks for sharing! I think I have a hunch as to why your materials aren't appearing properly, perhaps you could help me test it? In order for FME to apply the textures, it needs to be able to find the image files (PNGs). In my case, I don't have access to your PNG files, so the buildings were not textured. 

 

Taking a look at your MTL file, I can see the PNG's mapped to a very specific path: 

 

map_Kd D:<yourpath>

 

This is called an absolute path and FME will only look in this specific location for the PNGs. To simplify things, we can try to use relative paths. 

 

To do this, add a new folder in the same location as the OBJ and MTL files. We can call this folder 'texture'. To this new folder, add all your PNG's (see image).

 

image 

Next, we can update the map_Kd paths in the MTL file to: /texture/<pngname>.png. Assuming the texture folder is in the same location as the OBJ/MTL, I'd suspect FME will be able to resolve this. Please give this a try and let me know if you're able to see textured objects. Happy to help, Kailin

Hello @kailinatsafe​, yes I do confirm! Thanks again!

Reply