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: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 168 times and has 4 replies Next Thread
StefanH
Newbie




Joined: May 20, 2024
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Color of imported furniture is always grey

Hi,

I am new to Sweet Home 3D, and I would like to ask a question regarding the color of imported furniture.
My goal is to create a kitchen in my CAD package, and import this as furniture into SH3D.
Unfortunately the furniture is always grey after it is imported.

As an example I created a random green part in my CAD software, and exported it as a Wavefront file.
When I open the .obj file in the default Windows viewer, it is indeed green. The green is also in the .mtl file. Based on this I would think that nothing went wrong during the export from my CAD package.

But when I import it as furniture into SH3D, the part is always grey instead of green.
What am I doing wrong?
This is the mtl file:

newmtl DEFAULT_MTL
Kd 0.635 0.686 0.749

newmtl MTL0
Kd 0.000 1.000 0.000


I tried changing it to this, as I thought that might make the part red, but nothing changed unfortunately:

newmtl DEFAULT_MTL
Kd 0.900 0.100 0.100

newmtl MTL0
Kd 0.000 1.000 0.000


Looking forward to any advice!
[May 20, 2024, 3:43:51 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: 858
Status: Offline
Reply to this Post  Reply with Quote 
Re: Color of imported furniture is always grey

Several possible causes:
1. The "usemtl <materialname> in the obj file has no reference in the mtl file to "newmtl <materialname>.
2. The importer can't find the mtl file. The obj file should have a line close to the top with "mtllib <filename.mtl>" and "filename.mtl" should be in the same directory as the obj file.
3. The format of the mtl file is not standard Wavefront or is missing the needed values for Sweet Home 3D. And looking at your example that is the most likely reason. If you change the Kd into Ka you will see a little more I think but that still is very little information to work with.
Read the manual MTL_file_explained.pdf to get a better idea about what is needed in a MTL file. A regular newmtl block looks like this:

(Sweet Home 3D export, color)
newmtl MyMaterialName
illum 2
Ka 0.0 0.0 0.0
Kd 0.25 0.25 0.25
Ks 0.0 0.0 0.0
Ns 1.0
Ni 1.0

(Blender export, texture)
newmtl MyMaterialName
Ns 0.000000
Ka 0.000000 0.000000 0.000000
Kd 0.250000 0.250000 0.250000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_kd texturefilename.jpeg


ETA: if you change the color after import in Sweet Home 3D and export again you can see what is generated in the MTL file. If you export with a different obj file name it will not overwrite your original.
----------------------------------------
[Edit 1 times, last edit by Keet at May 20, 2024, 9:31:14 PM]
[May 20, 2024, 9:24:48 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
StefanH
Newbie




Joined: May 20, 2024
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Re: Color of imported furniture is always grey

Hi Keet,

Thank you very much for your extensive explanation!

I thought that the 3rd possible cause would most likely be the issue (the default Windows viewer does show the green color, I think that confirms that it is not possibility 1 or 2).

Changing Kd into Ka unfortunately did not change anything.

However, the document that you sent is very relevant. There are also some interesting references mentioned on the last page I see, so I will dive into the topic a bit deeper and hopefully after that I am able to solve the issue.
[May 25, 2024, 2:35:51 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: 858
Status: Offline
Reply to this Post  Reply with Quote 
Re: Color of imported furniture is always grey

Changing Kd into Ka unfortunately did not change anything.
Apparently Sweet Home 3D needs both Ka and Kd to show the correct color. If you copy the Kd value and add it as Ka value the correct color should show:
newmtl DEFAULT_MTL
Ka 0.635 0.686 0.749
Kd 0.635 0.686 0.749

newmtl MTL0
Ka 0.000 1.000 0.000
Kd 0.000 1.000 0.000

This is minimal and really not a good representation of a material. Check you CAD program to see if you can get it to create a better export of the material.
The most important is that your CAD program exports all the material names. After import in Sweet Home 3D you can set colors and textures for each material and optionally export to obj again. The export from Sweet Home 3D should create a correct mtl file with illum, Ka, Kd, Ks, and Ni values.
[May 25, 2024, 3:30:42 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Xiste
Advanced Member
Member's Avatar

Norway
Joined: Apr 18, 2014
Post Count: 228
Status: Offline
Reply to this Post  Reply with Quote 
Re: Color of imported furniture is always grey

If your CAD-program can export Collada files (dae), that might solve your problem fast and easy.
[May 25, 2024, 9:23:29 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ 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