Posted by: Peter Quirk | July 15, 2008

Taking Sketchup models into realXtend

Update 12/22/2008: A new tutorial and improved process for importing models from Sketchup is now available.

How would you like high quality assets like this office chair in your realXtend world?

Office chairs in realXtend world

Office chairs in realXtend world

 

Of course you would! Let me explain how to decorate your world with a rich variety of objects from the Google 3D Warehouse by taking advantage of Google’s Sketchup program to convert the objects to the Ogre mesh format. The following procedures were developed on a Windows PC, Mac and Linux users are encouraged to document their own procedures.

If you haven’t got Sketchup installed, install it from http://sketchup.google.com/download/. After installing it, download a copy of the Ogre mesh exporter plugin from http://www.di.unito.it/~nunnarif/sketchup_ogre_export/. Follow the instructions in the README file to edit the configuration file to specify where the .mesh, .material and texture (.jpg) files will be written. I send them all the same folder on my desktop.

Fetch the rexexporttools_0.3.zip file from the rex download site. I have installed the rexmeshtool and the xml2mesh tools into the target folder for the Ogre mesh exporter to make things easy. (From experience, I learned that this folder should not be subordinate to the server or client directories in C:Program Files because the uninstaller does a thorough job of removing all files.)

I recommend not running Sketchup and the realXtend viewer at the same time. I have experienced viewer crashes at startup when Sketchup is running. You may find that cannot login to your world until you terminate Sketchup and clear your viewer cache.

Start Sketchup. You’ll see something like this:

The start screen in Google Sketchup

The start screen in Google Sketchup

Note the size of the human, then delete him by selecting him with the arrow key (already the active tool in this screenshot) and pressing the delete key.
To import a model from the Google 3D Warehouse, click on the import models button (second from the right with the tooltip below it in the shot above.) In the search box, enter  the word “Atomik” and you’ll see a search result like this.
Google Sketchup search result

Google Sketchup search result

Click on the bureau example to see a larger image, and click on the download button to bring it into Sketchup. You’ll be prompted to proceed. Place the quad-arrow cursor at the origin for a result like this:
After loading the model into Sketchup

After loading the model into Sketchup

We have a problem because the scale of this model is huge. Remember how big the human was before you deleted him? To see the full model, press the Zoom Extents button (the one to the right of the magnifying glass). The bureau will now appear in all its beautiful detail.
Zoomed out view of model

Zoomed out view of model

While everything is selected (outlined in blue), pull down the Edit menu, select “Component (1 in model)”, then Edit Component. Click on the chair to select it. While it’s still selected, pull down the tools menu and choose Export Selected to Ogre.
Export selected component to Ogre

Export selected component to Ogre

Name the file office_chair and press OK. After a short while, the exporter will report that you have exported 25329 triangles, 1 submesh and 63 materials. Don’t worry about the large number of materials. Even though realXtend can only handle eight materials today, there is only one used in the chair.
Start a Command line in the directory where you exported the mesh and material. (I use the WIndows XP Powertoy “Open Command Window here” while pointing at the folder name. It’s a standard feature in Vista. For more info, see here.)
From the command prompt, type xml2mesh office_chair and observe a screenful of output with a fatal error at the end about a missing skeleton file. This procedure assumes you have copied the xml2mesh file into the same folder as the mesh.
Start the rexmeshtool with the command rexmeshtool office_chair.mesh. If the rexmeshtool crashes due to a duplicate material definition, ensure that there is only one .material file in the folder. I add a .cloaked extension to each file after I have processed it.
You won’t see the chair anywhere in the rexmeshtool because a) it was huge; b) it was not centered when we exported it. To rescale it, enter 0.01 in the scale box. With luck it should be partly on screen to the far right. Center it by selecting X ALign = Center.
Chair partially in rexmeshtool

Chair partially aligned in rexmeshtool

Note that the rexmeshtool grid is on 1 meter centers. The cursor in the screen shot is pointing to one of these dots, so the chair is about 1.5m high. Complete the alignment by selecting Y Alingn = Min and Z Align = Center. Rotate the chair 180 degrees by setting Y Rotate to 180. Select Save Changes and Exit and launch the realXtend viewer.
In the viewer, select File -> Upload 3D Model. navigate to the folder where your meshes and associated files are and select the office_chair.mesh file. The model will appear after some delay in a new 3D Models folder in your personal inventory.
Create a box prim on the ground, set the name of the object to office chair, and activate the rex tab. Select the Extended properties and Show as mesh options. Open your inventory folder and drag the office_chair 3D model onto the Mesh Name box. Your setup will resemble this:
Box prim with chair mesh applied

Box prim with chair mesh applied

On the material dropdown, you’ll see that only one material is used. We want a black texture, and there’s one called discoblack under OpenSim Library/World Library/textures in your inventory folder. Drag the texture onto the Material name box while the dropdown displays 1.
(For more complex models, you select each material by index number and drag an appropriate texture onto the input box. For example, if you export the LCD monitor from the Bureau model we used above, you will find that it uses four materials. One of them is a JPG called Win_Vista_Aero. This will be dumped into the target directory when export the model from Sketchup. Another is the basic black, while the other two are used for the lights or switches at the bottom right of the screen. I created some basic color swatches in red, green, blue, white, yellow, etc. which I drag onto the material name box to identify the part of the material to be colored, then I choose an existing texture or make a better color swatch for it. The chair in the first and last images on this page uses a nice charcoal swatch that I created in Paint.Net and uploaded to my texture library.)
Now that you’ve got a black (or charcoal) chair, complete the operation by stretching the prim to get the chair sized just right, and adjust the position so it sits nicely on the ground. Finally, take it into your inventory.
In a subsequent post I’ll explore how to adjust the sittarget so that your avatar sits nicely in the chair. For now, the best way to sit your avatar is to stand behind the chair, right-click on the chair and select Sit here. If the chair doesn’t select when you click, try holding down the Z key when you select it. Alternatively, picture the box prim that the chair is built on. In the picture above, you can see that the prim is below the seat, so try clicking lower. If the avatar is too high or too low, edit the prim, select the Edit linked parts option, then select the box prim again. Raise or lower the chair until the avatar looks natural on the seat.
Chair being fitted to sitting avatar

Chair being fitted to sitting avatar

Clear the Edit linked parts option and reposition the chair so that it sits correctly on the ground.
If you look closely at the first image in this posting, you’ll see that I imported an LCD monitor and a file cabinet from the bureau model. The keyboard came from another model that didn’t use as many materials. In the second image above this paragraph, you can also see wooden benches and a market umbrella behind the inventory menu.
I hope you have as much success filling your world with these wonderful public domain models. One of our upcoming challenges is how to develop a formal mechansim for crediting the designers of these assets. If you’ve got a suggestion on how to do this, please share it with everyone by adding a comment.
Advertisements

Responses

  1. […] on the experience of Peter Quick (https://peterquirk.wordpress.com/2008/07/15/taking-sketchup-models-into-realxtend/) and in preparation for the project modul “Identities in 3D online communities” I tried […]

  2. Help! I followed the instructions ( I think ) but Im getting stuck at the part where you go tools-export selection. When I do that the window to give a title pops up and I type the title in and click ok. The problem is nothing happens after that, nothing comes up and no files get added to the folder I set. Help.

  3. I would check your configuration.
    1. Your plugins directory in Sketchup should look something like this:
    Directory of C:\Program Files\Google\Google SketchUp

    06/25/2008 03:51 PM .
    06/25/2008 03:51 PM ..
    05/06/2008 06:08 PM 3DxSketchUp
    07/24/2006 03:17 PM 91 3DxSketchUp.rb
    05/14/2006 02:07 PM 2,868 backface.rb
    05/06/2008 10:24 PM Examples
    12/03/2007 01:03 AM 2,403 examples.rb
    06/28/2008 08:48 PM 1,505 ogre_config.rb
    06/13/2006 12:14 PM 9,085 ogre_export.rb
    05/06/2008 10:24 PM Utilities
    12/03/2007 01:03 AM 1,165 utilities.rb

    2. The ogre_config.rb file should look something like this:
    # Sketchup To Ogre Exporter Configuration File Version 1.0.1

    # Sketchup coords are in inches. The scale value converts inches into ogre units.
    # scale = 0.0254 -> 1 ogre unit = 1 meter
    # scale = 1 -> 1 ogre unit = 1 inch
    # scale = 2.54 -> 1 ogre unit = 1 centimeter
    $g_ogre_scale = 0.0254

    # If true, the exporter will copy all sketchup textures used in the model
    # into the directory set in $g_ogre_path_textures.
    $g_ogre_copy_textures = true

    # Destination path for meshes (the *.mesh.xml and *.mesh files end up here).
    $g_ogre_path_meshes = “c:\\documents and settings\\username\\desktop\\realxtend models\\meshes”

    # Destination path for materials (the *.material scripts end up here).
    $g_ogre_path_materials = “c:\\documents and settings\\username\\desktop\\realxtend models\\meshes”

    # Destination path for textures (all textures end up here if $g_ogre_copy_textures is set to true).
    $g_ogre_path_textures = “c:\\documents and settings\\username\\desktop\\realxtend models\\meshes”

    # Path of OgreXmlConverter.exe. This is required to auto convert xml meshes into binary.
    $g_ogre_path_xml_converter = “c:\\OgreCommandLineTools\\OgreXmlConverter.exe”

    # If true, materials will be exported.
    $g_ogre_export_materials = true

    # If true, meshes will be exported.
    $g_ogre_export_meshes = true

    # If true, auto conversion of xml to binary meshes will be performed,
    # using the converter exe specified in $g_ogre_path_xml_converter.
    $g_ogre_convert_xml = true

    You can test the setup by clicking on the man in the empty startup frame and trying to export him. You should see a popup that says:
    Triangles = 297
    Submeshes = 8
    Materials = 9
    When you click the OK button, a DOS command window will briefly execute the OgreXMLconverter.

  4. Hi,

    I can’t upload the model, every time I try,

    rex viewer shows an error: Unable to import 3D Model (.mesh) format requiered.

    But I think I do everything right.

    Can anyone help me??

  5. Dima, meshes produced this way don’t load into realXtend 0.4 for some reason. I’m doing some experiments to find out why.

  6. […] into realXtend Posted by Peter Quirk under Uncategorized   Back in July I posted a tutorial on how to use Google Sketchup to bring models from the Google 3D Warehouse into realXtend. It […]

  7. […] by the Blog from Peter Quirk (“Taking Sketchup models into realXtend“) and in preparation for the BA project modul “Identities in […]

  8. Hello everyone!

    For does that still have the problem “after the typebox, nothing” there is the explanation for it.

    first of all YOU NEED OGRE COMANDLINE TOOLS

    There it is to download and then install, check where they are installed you will need that!

    http://downloads.sourceforge.net/ogre/OgreCommandLineTools_1.6.0.msi?use_mirror=

    After this you need to edit your “ogre_export_config.rb” and put any destination folder in this 3 parts:
    in here : # Destination path for meshes (the *.mesh.xml and *.mesh files end up here).
    in Here: # Destination path for materials (the *.material scripts end up here).
    And here: # Destination path for textures (all textures end up here if $g_ogre_copy_textures is set to true). ANY PATH WILL DO IT, AS LONG THAT THEY HAVE THE DOUBLE BRACKETS, LIKE THIS “C:\\MYWORK\\BLABLA\\” IT HAS TO HAVE THE DOUBLE BRACKETS. DONT ASK ME WHY, I DONT KNOW :) hehehe

    and now the part that you need the OGRE COMANDLINE TOOLS, still in the ogre_export_config.rb u have to put the path where you installed it OGRE mine is in here:
    # Path of OgreXmlConverter.exe. This is required to auto convert xml meshes into binary.
    $g_ogre_path_xml_converter = “G:\\OgreCommandLineTools\\OgreXmlConverter.exe” check DOUBLE BRACKETS again! :)

    And so like this it will work, well it will export at least, ofcourse it wont load to secondlife, because you cant upload a 3d project into secondlife, i dont know if will on other grids, i didnt tested yet!

    i hope i have helped someone with this short explanation. :)

  9. Thank you a lot ! It worked perfectly…except to sit on the chair :)

    If i move the ‘chair prim’, the avatar moves also…impossible to fit.

    It would be great if you could explain this important detail :)

    Best regards from France.

    Hugobiwan

  10. Thanks for the feedback! There is a fundamental problem with the setting of the sittarget when you use meshed avatars as realXtend and modrex do. I submitted a bug about a year ago asking for direct support in the rex panel but it hasn’t been addressed. A poseball would be one way to handle this, but it would be so much better if there was a way to indicate the orientation and position of the avatar’s spine.

  11. hi every one,

    I am having a trouble with rex tab. I created prim, now when activate rex tab, I do not find ‘extended properties’ option.
    Can any one tell whats the wrong could be here ?
    thanks a lot in advance for any kind of help……


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: