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




Joined: Feb 6, 2010
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Is it possible to give Texture to Furniture?

this is my only wish about sweethome, after this feature, this programm will be perfect!! to give texture to the furniture!
[Feb 6, 2010, 10:47:35 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
alied
Member
Member's Avatar

Argentina
Joined: Sep 8, 2009
Post Count: 40
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

1- It is possible to have the texture already on the model, which would be a static texture, but I guess that is not what you mean.
2- A plug-in could be done so you can change a texture on a furniture. It is not that difficult:
-Scan the model J3D tree and put all material defined on a list.
-Change the desired texture.
-Make a UI to do the above and select the texture.
[Feb 6, 2010, 3:35:18 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

Hum... you would have to generate UV texture coordinates too. wink
Java 3D has something to help you generate some default UV coordinates but I don't how well it works.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 6, 2010, 3:39:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
alied
Member
Member's Avatar

Argentina
Joined: Sep 8, 2009
Post Count: 40
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

Well, that was a rough outline. I've changed textures on-the fly, but I've allways tried to have a dummy texture before (to know where to do the change) with a named material.

private void deepUpdateMaterial(Node node) {
if (node instanceof Group) {
Group bg = (Group) node;
for (int i = 0; i < bg.numChildren(); i++) {
Node shape = bg.getChild(i);
deepUpdateMaterial(shape);
}
} else if (node instanceof Shape3D) {
Shape3D shape = (Shape3D) node;
Appearance material = shape.getAppearance();
if (material != null) {
shape.setAppearanceOverrideEnable(true);
String texture = null;
/*
Here, set the texture to whatever is to set
*/
if (texture != null) {
BufferedImage textureImage = null;
try {
textureImage = ImageIO.read(new URL(texture));
} catch (IOException ex) {
// Ignore images at other format
}
if (textureImage != null) {
TextureLoader textureLoader = new TextureLoader(textureImage, TextureLoader.GENERATE_MIPMAP | TextureLoader.BY_REFERENCE);
material.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);
material.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
material.setTexture(textureLoader.getTexture());
}
}
}
}
}

That is how I do it, and it works. Emmanuel, some of this code would seem familiar to you :-). Anyway, in this case there is already a defined material. If there weren't any, you should have to list all shapes and assign a texture for each, and create materials as needed.

Why not to post this to the developpers forum, in case someone wants to try?
----------------------------------------
[Edit 1 times, last edit by alied at Feb 7, 2010, 6:18:34 PM]
[Feb 7, 2010, 6:14: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 
nightrain
Newbie




Joined: Feb 6, 2010
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

I am a simple user buddies :) I mean it in this way; you can easily change the texture of walls or floor, because there is a option on the menu ( you can change color or texture of walls) but on furnitures, there is only the option to change the color. is it not possible to add the texture option also to the furnitures? most importantly, to the boxes, because I create new furnitures with boxes :)
[Feb 8, 2010, 1:02:55 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

Texture on boxes is an other simpler story and a wizard that will let you create parallelepipeds with images on each face should be available soon.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 8, 2010, 1:14:46 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
alied
Member
Member's Avatar

Argentina
Joined: Sep 8, 2009
Post Count: 40
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

Do you mean to apply a texture to the WHOLE model? It's simpler on the User interface part only. Inside there is no much difference.
So far, there is a tip:
sh3d files are actually zip files (technically they are jar files, wich in turn are zip files with specific parameters). You can replace a texture by opening it with any zip utility and replacing the desired texture with the new one, provided you keep the name and format.
[Feb 8, 2010, 1:29: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 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Is it possible to give Texture to Furniture?

For your information, applying texture to furniture models will be available in next version 2.3.
If you're interested, you can text this feature in current Beta version.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 21, 2010, 3:09:25 AM] 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