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: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 2274 times and has 10 replies Next Thread
Hedaja
Newbie




Joined: Dec 5, 2020
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Organizing textures within a model

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.
[Jul 22, 2023, 5:17:00 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: 789
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

Yes this can be done. This is going to be a pretty long answer smile

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.
[Jul 24, 2023, 2:19:43 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: 789
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Jul 24, 2023, 2:33:47 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Vinci68
Member
Member's Avatar

France
Joined: Feb 24, 2022
Post Count: 48
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

Thanks Keet for these explanations, which will help many other users of Sweet Home 3D to understand .obj and .mtl files.
[Jul 24, 2023, 2:48:13 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: 789
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

Thank you! I try to help other users to get the most possible out of Sweet Home 3D.
----------------------------------------
[Edit 1 times, last edit by Keet at Jul 24, 2023, 5:05:49 PM]
[Jul 24, 2023, 5:05:23 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Hedaja
Newbie




Joined: Dec 5, 2020
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

Thanks Keet for the very detailed explanation.
I'll give it a try when I'm back home.
[Jul 24, 2023, 5:28:25 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Hedaja
Newbie




Joined: Dec 5, 2020
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

Didn't use a wall element. It's all boxes besides the pillows.
[Jul 24, 2023, 5:29:04 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: 789
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Jul 24, 2023, 6:03:39 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Hedaja
Newbie




Joined: Dec 5, 2020
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Organizing textures within a model

I did not. I don't think I saw a diagonal texture on my model. I'll check again and update the one linked once I get things figured out
[Jul 24, 2023, 7:39:23 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: 789
Status: Offline
Reply to this Post  Reply with Quote 
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.)

https://www.mediafire.com/file/mm4isi2up7clhyb/Change_Material_Names.pdf/file
https://www.mediafire.com/file/9sud9x34ko2nr9...rial_Names_files.zip/file

@Emmanuel
If you think it's good enough you're free to add it to the Sweet Home 3D help files.
[Jul 24, 2023, 7:46:43 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: 11   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