I created a sofa model within Sweethome 3D. I used 'copy as new furniture' plugin at the end to merge things together. But I just realized that materials in the model are quite a mess. Is there a way to clean up which things share materials and how they are named? For example the boxes have a seperate texture option for each side and I'd like to merge that into one.
At least I have figured out that grouping an opject before exporting makes the textures for those objects merge. Therefore in the new model all pillows for example that were grouped together will share the same material.
Netherlands
Joined: Apr 8, 2022
Post Count: 1366
Status:
Offline
Re: Organizing textures within a model
Yes this can be done. This is going to be a pretty long answer
When you create your sofa you do so by creating parts like the arm rests, cushions, etc. Make sure you have put on the textures you want. Doesn't matter yet what texture but this is to enable you to orientate each side correctly. It might be that you have to rotate a side or top to align it with other sides.
To make it easier export each part separately so you have an .obj and .mtl file for each part. The name for the obj/mtl files doesn't really matter since they are only used temporarily until you have your complete sofa. So if you can recognize what is what that is sufficient. Obj and mtl files are plain text files.
Now you have to edit each part to create the property names you want. Let's take an arm rest as an example. Use a plain text editor for this, not something like Word or LibreOffice. From what I see it's a box which means that when you open the obj file you will see 6 groups (lines starting with "g "): bottom, top, left, right, front, and back. After each line starting with "g " there is a line with "usemtl ???". This is the reference to the material to use for that group (side). The material itself is described in the mtl file. We'll get back to that. To use an unimaginative name let's use "ArmRest" as the property name for the arm rest. Replace all lines with "usemtl ..." with "usemtl ArmRest".
Now the mtl file. Since we have only one property references in the obj file we will only need one block in the mtl file. So remove all blocks except the first one. That block is probably named "newmtl bottom". Change that line to "newmtl ArmRest".
Save both the obj and mtl file. Drag the obj file into your 2D window and the import furniture dialog will appear. Follow the normal process of importing furniture.
When you choose "Modify Furniture" for your arm rest you will see that it has only a single property "ArmRest" and when you change the texture it will do so for all sides.
Repeat the process for all parts selecting the property names you want for each part. Just make sure that if you want another part to have a name that you already used on a previous part that the block in the mtl file is exactly the same. Easiest is to just copy that block for the mtl that uses the same name. It doesn't matter if a part has more or less g groups, just replace all "usemtl" lines with the property name you want.
When all parts are done and imported you arrange them into your sofa and export all parts together. After import of your sofa you will have all your material names as you created them.
It's a little cumbersome to have to edit outside Sweethome3D but after you've done this a couple of times it becomes second nature. It also gives you a good understanding about how objects are created and stored.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1366
Status:
Offline
Re: Organizing textures within a model
I just noticed you probably used a wall for the arm rests. Don't use a wall, use a box because you can see that the side of the arm rest has it's texture diagonal. That's a problem caused by how the wall objects are constructed. Wall-ends are textured half as the left side and half as the right side, they don't have their own material. With a box you can achieve the same but have all sides with correctly oriented textures. If you WANT to have one side diagonal you can rotate the texture for that side on the box in the modify texture dialog. Do this before you export and edit the obj file.
Another tip: you probably only have to edit one arm rest, one foot, and one cushion. After import you can copy and resize the cushions and if necessary rotate the copy of the second arm rest.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1366
Status:
Offline
Re: Organizing textures within a model
Thank you! I try to help other users to get the most possible out of Sweet Home 3D.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
----------------------------------------
[Edit 1 times,
last edit by Keet at Jul 24, 2023, 5:05:49 PM]
Netherlands
Joined: Apr 8, 2022
Post Count: 1366
Status:
Offline
Re: Organizing textures within a model
Didn't use a wall element. It's all boxes besides the pillows.
Did you rotate the texture on the side of the arm rest to diagonal on purpose? Because for a box it's unusual to get that by default.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1366
Status:
Offline
Re: Organizing textures within a model
Here's a manual I created about changing material names. It includes example files in a separate zip. (I'm not that good at creating manuals but I think most users will understand what it says.)
@Emmanuel If you think it's good enough you're free to add it to the Sweet Home 3D help files.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects