Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 14
Posts: 14   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1345 times and has 13 replies Next Thread
bashnprint
Newbie



Canada
Joined: Jun 15, 2023
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Textures not importing

Hey all,

I'm attempting to import a piece of furniture as an .obj file that has its texture image files separate, but within the same folder. When I import the .obj file it doesn't bring in the textures, its only the model itself.

Am I missing something that will import the textures as well?

Thanks for the advice!
[Jun 15, 2023, 11:28:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
hansmex
Advanced Member
Member's Avatar

Netherlands
Joined: Sep 26, 2009
Post Count: 3952
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

An SH3D model with textures comes as several files:
- the model in an OBJ file
- the description of materials in an MTL file
- the textures in separtate JPG or PNG files.

These files can come separate or zipped into one single file.

If the files are not zipped, you must make sure that the files stay together and that their relative addresses do not change.

Example: If you download the files in the folder Downloads, and move the OBJ file to the House folder, the relative addresses will change. If you copy all files in one go from Downloads to House, the relative addresses will stay the same.

Other possibilities may include missing fioles, or files with incorrect description.

H
----------------------------------------
Hans

new website - under constuction
hansdirkse.info
[Jun 16, 2023, 5:34:10 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 790
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

To understand the relation between obj, mtl, and texture images:

Usually the obj and mtl file have the same filename with the extensions .obj and .mtl.
Possible cause for not seeing material: the mtl file is missing.

The obj file has a line close to the top "mtllib filename.mtl". This means that it has to use the file "filename.mtl" for material references.
Possible cause for not seeing material: the reference to the mtl file is wrong.

The mtl file has one or more sections "newmtl materialname" where each section has a unique material name. After the line "newmtl" the material and it's properties are described. Sections are separated by a empty line so it's easy to see the sections.
Possible cause for not seeing material: the mtl file formatting is wrong.
Very unlikely but still a possibility.

In the obj file you will see lines "usemtl materialname". That means that from that point on the described surfaces (faces) will use that referenced material name.
Possible cause for not seeing material: the material named in the obj file doesn't exist in the mtl file.
Note that the material names between the obj and mtl file are case-sensitive which means that "MaterialName" and "materialname" are references to different materials.

The section newmtl in the mtl file can contain a line starting with "map_Kd " followed by a path and file name to a texture image file. Usually there is no path and just a filename which indicate the texture images should be in the same folder as the obj and mtl file.
Possible cause for not seeing a texture: the referenced texture image doesn't exist, is named differently, has an invalid image format, or has a wrong path.

If Sweethome3D shows a single material "default" after import this means that it couldn't find the references to the material for one of the above mentioned reasons.

If you imported an obj file not generated by Sweethome3D you can export it from Sweethome3D and then look at the obj and mtl files. Sweethome3D creates a very clean format where each group ("g ..." line in the obj file) is followed by the "usemtl ..." line. That way you can easily see which group uses what material. This doesn't always work because not every third party software creates clean obj files.
Since both obj and mtl files are plain text files you can correct errors you find with a simple text editor. Don't use MSWord or LibreOffice Writer, just a simple text editor.
[Jun 16, 2023, 8:38:44 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bashnprint
Newbie



Canada
Joined: Jun 15, 2023
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

The section newmtl in the mtl file can contain a line starting with "map_Kd " followed by a path and file name to a texture image file. Usually there is no path and just a filename which indicate the texture images should be in the same folder as the obj and mtl file.
Possible cause for not seeing a texture: the referenced texture image doesn't exist, is named differently, has an invalid image format, or has a wrong path.


This was the solution! I managed to get the basic texture now loaded onto the model I was trying to import, thank you!

Now just out of curiosity, the model I downloaded included 4 different texture files: a basic one (which is what I used), but also included a "cavity", "normals", and "occlusion" version. I assume these remaining 3 files are for other purposes and not for use here?
[Jun 16, 2023, 6:12:58 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 790
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

The other three files are not used by Sweethome3D. They are special overlay images used by programs like Blender and other 3D software to add specific characteristics to a model like shading and reflection. Sweethome3D only uses the base image for a texture.
[Jun 16, 2023, 6:18:07 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bashnprint
Newbie



Canada
Joined: Jun 15, 2023
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

...actually I stand corrected, I apparently did not get it to work.

The model appears to have textures in the 3d preview window, but when I actually render a photo the model is black, with no textures.
[Jun 16, 2023, 6:18:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bashnprint
Newbie



Canada
Joined: Jun 15, 2023
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

The model only appears to show textures if I lower the quality of the photo render. Not sure why that's happening?
[Jun 16, 2023, 6:38:49 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
hansmex
Advanced Member
Member's Avatar

Netherlands
Joined: Sep 26, 2009
Post Count: 3952
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

Is it a model imported from Sketchup Warehouse?

H
----------------------------------------
Hans

new website - under constuction
hansdirkse.info
[Jun 16, 2023, 6:45:05 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bashnprint
Newbie



Canada
Joined: Jun 15, 2023
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

No, it's one I downloaded from CGTrader.

On a hunch I tried loading it into Blender and adding a decimate modifier in the thought that maybe there were too many faces or it was too high quality, but this didn't change anything sadly.
[Jun 16, 2023, 6:50:14 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 790
Status: Offline
Reply to this Post  Reply with Quote 
Re: Textures not importing

Some advise when you download from CGTrader: always download all formats available (obj, mtl, 3ds, dae, fbx, blend). In many cases importing a 3ds or dae model in Sweethome3D works better than importing the obj file. Also be aware that some models require downloading the textures in a separate file. You can see that in the list of available downloads.

You use the fbx file when all else fails: import it in Blender en export it as obj or 3ds. Then you can import the model in Sweethome3D. Sometimes it even works better to import first in Blender and export it to obj or 3ds. (Often the export to 3ds is more accurate then the obj export.)

You will probably have to learn some Blender anyway if you download more from 3D model sites: sometimes parts are shifted and you need Blender to fix those mistakes.
[Jun 16, 2023, 7:44:08 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 14   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved