In a recent post I described changes to the Ogre export scripts for Sketchup to simplify the import of models into realXtend from Google’s 3D warehouse via Sketchup. At the time, there was a bug in the newly-released realXtend 0.4 viewer which prevented the importing of meshes that didn’t have textures associated with some faces. That problem has now been fixed with the release of a new realXtend viewer. You can fetch the new realXtend.exe from Sourceforge.Net. It’s just a replacement executable, not a complete installer file. Pick up realXtendviewer_0.4_fix.zip here.
I recommend modeling with Sketchup 7. The new templates for working in different measurement units make it so much easier to build models that transfer correctly to realXtend if you choose one that is in meters. Start with “Simple template – meters” if you can’t decide. If you haven’t installed Google Sketchup, you can get it here. After installing it, you need to add two files to the Sketchup plugins directory. You can retrieve them from here.
Before following the tutorial steps below, be sure to edit the ogre_export_config.rb file. As distributed, its assumes that the user’s login name is “Peter” and that there is a folder called “My Models” under “My Documents”. The username on line 39 also needs to be changed unless your login is “Peter”. You must create the target directory “My Models” or whatever you use before running the procedure. Also, edit line 47 to reflect the location of the OgreXmlConverter tool and line 54 to indicate the location of the rexmeshtool.
The following screenshots illustrate how to use the tool chain to import models into realXtend very quickly.
Step 1 – delete the avatar. With the selection tool (arrow) selected, click on the avatar and press the DEL button.
Step 2 – File –> 3D Warehouse –> Get Models…
Step 3 – In the search box, enter “Bedroom dresser”.
Step 4 – In the search results, select “Dresser with Mirror” by Bearly. We’ll use this model for another tutorial about making mirrors. When you click on the model, you are presented with a more detailed view that allows you to rotate the object and see the sides and back. Note that the dimensions are also provided on the details page.
Step 5 – Click the Download button to load the model into Sketchup. The model is inserted. Your cursor is the four-headed move/copy one, indicating that you can position the object before left-clicking to finalize the placement. Try to place the dresser at the origin, with the model centered on the origin.
Step 6 – Make sure the model is selected (highlighted in blue.) If it is not, click the selection tool (the first icon on the toolbar) and click on the model.
Step 7 – Export the model and launch the xml2mesh and rexmeshtool. Tools –> Export Selection to Ogre Mesh
Step 8 – Enter a name in the popup box that asks for a name for the model and click OK.
Step 9 – Verify that the export produced a non-zero number of triangles and click OK to proceed. If you do see a zero triangle count it is because you forgot to select the model before exporting it. Note the number of materials. If it exceeds 12 you will have a problem assigning all the materials in realxtend.
The OgreXlmConverter will be launched in a console window. You will typically see an error message at the end about no skeleton being present – just ignore it. Next you will see the rexmeshtool splash screen. It wants you to select DirectX or OpenGL rendering. It doesn’t matter which one you choose.
Step 10 – Adjust the positioning of the model in the rexmeshtool.
- Set the X, Y and Z Align drop downs to “center”. This ensures that the mesh will be centered in the base prim that you map in onto in realXtend
- The axes are different between rexmeshtool and realXtend. To rotate the dresser so it faces you, set the Y Rotate value to 90 degrees.
Step 11 – Click “Save changes & exit”. If you inspect your “My Models” folder, you will now have a sub-folder called “Dresser” and within it will the following files:
If any errors occurred in any of the export and conversion steps, they will be listed in the logfiles which are conveniently separated from the logfiles for every other model.
Step 12 – Import the mesh and the materials into realxtend.
- Create a cubic prim and size it roughly to the proportions of the dresser
- In the rex / display tab assign the Dresser mesh to the mesh name
- As this point the mesh becomes visible and you can determine whether the orientation is correct for the intended location. I prefer to size the underlying prim to the exact size if known. You will recall from step 4 that the dimensions were listed as 6’ 6 7/16” H x 62” W x 20” D. In metric that’s 1.992m x 1.575m x .508m. Adjust the X, Y and Z size fields in the Object tab to suit your object’s orientation and set the “Scale Mesh to Prim” option in the rex / Display tab.
- On the rex / material tab, assign the materials in the order 1_Wood_Cherry, 2_Metal_Corrogated_Shiny (sic), and 2_Metal_Corrogated_Shiny. Note that there are only three materials, not four as reported by the Ogre exporter (presumably because some triangles have been merged.) Note also that the prefix on the materials in this screenshot doesn’t match the filenames above as a result of having to redo some of the screens at a different time.
Voila! You have a nice dresser, correctly scaled!
You’ll find that this procedure takes very little time once you are familiar with it, typically a couple of minutes. The whole world of the Google 3D Warehouse is now available to you. Please observe the usage rights of model owners. I recommend setting the object description to the TinyURL of the model, which in this case is http://tinyurl.com/7y8gr5.
UPDATE: Learn how to make the mirror reflect like a real mirror using this tutorial.