Joined: May 20, 2024
Post Count: 2
Status:
Offline
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:
Netherlands
Joined: Apr 8, 2022
Post Count: 1248
Status:
Offline
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.
---------------------------------------- Dodecagon.nl 950+ 3D models, manuals, and projects
----------------------------------------
[Edit 1 times,
last edit by Keet at May 20, 2024, 9:31:14 PM]
Joined: May 20, 2024
Post Count: 2
Status:
Offline
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.
Netherlands
Joined: Apr 8, 2022
Post Count: 1248
Status:
Offline
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.
---------------------------------------- Dodecagon.nl 950+ 3D models, manuals, and projects