Print at Feb 24, 2020, 10:49:00 AM

Posted by Puybaret at Oct 12, 2007, 7:27:00 PM
Re: AOI - colored objects?
Ok, I'll give here more details about the answer I posted yesterday at https://sourceforge.net/forum/message.php?msg_id=4562508

I you want to add colors to your OBJ models, you should open an OBJ file you generated in a text editor and study the tokens "g" and "usemtl" of the OBJ format described at http://download.java.net/media/java3d/javadoc...bjectfile/ObjectFile.html .

The token "g" followed by a text, describes the name of a part of the object.
For example in the railing.obj file you created, there is a line "g Cube_1".

To specify the color of a part, add a new line under a line starting by "g", and type in that line "usemtl" followed by a space and the name of one of the colors described in OBJ format. Here is the list of supported colors :
amber amber_trans aqua aqua_filter
archwhite archwhite2 bflesh black
blondhair blue_pure bluegrey bluetint
blugrn blutan bluteal bone
bone1 bone2 brass brnhair
bronze brown brownlips brownskn
brzskin chappie charcoal deepgreen
default dkblue dkblue_pure dkbrown
dkdkgrey dkgreen dkgrey dkorange
dkpurple dkred dkteal emerald
fgreen flaqua flblack flblonde
flblue_pure flbrown fldkblue_pure fldkdkgrey
fldkgreen fldkgreen2 fldkgrey fldkolivegreen
fldkpurple fldkred flesh fleshtransparent
flgrey fllime flltbrown flltgrey
flltolivegreen flmintgreen flmustard florange
flpinegreen flpurple flred fltan
flwhite flwhite1 flyellow glass
glassblutint glasstransparent gold green
greenskn grey hair iris
jetflame lavendar lcdgreen lighttan
lighttan2 lighttan3 lighttannew lightyellow
lime lips ltbrown ltgrey
meh metal mintgrn muscle
navy_blue offwhite.cool offwhite.warm olivegreen
orange pale_green pale_pink pale_yellow
peach periwinkle pink pinktan
plasma purple red redbrick
redbrown redorange redwood rubber
ruby sand_stone sapphire shadow
ship2 silver skin sky_blue
smoked_glass tan taupe teeth
violet white yellow yellow_green
yellowbrt yelloworng

For example in the railing.obj file you created, if you want the color of the part "Cube_1" be grey, you should add the line :
usemtl grey

As long as you don't add any other line starting by "usemtl" token, all the other following parts will be colored with the previously specified color.
Thus, if you want to change the colors of the other parts, you should add other lines starting by "usemtl".

Once, you have finished with these "usemtl" lines, save your file and try it in Sweet Home 3D Import furniture wizard.

To help you choose a color, please download the image http://sweethome3d.sourceforge.net/Java3DCubeColorsWithTransparency.png : it shows all the colors listed above.

You'll see that among these colors, some are transparent. You may use these colors for window panes.
You can also name a part with a name starting by "sweethome3d_window_pane" to make that part transparent, as in the example http://sweethome3d.cvs.sourceforge.net/sweeth...content-type=text%2Fplain , that matches the "Double window" of Sweet Home 3D.

Finally, don't hesitate to open the Sweet Home 3D OBJ files available at http://sweethome3d.cvs.sourceforge.net/sweeth...sweethome3d/io/resources/ , and the ones available at http://sweethome3d.sourceforge.net/importModels.html to view some real examples.




----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer