 |
Importing 3D Models from Google 3D Warehouse
From RexWiki
This tutorial is originally written by Peter Quirk and is available with pictures at:
http://peterquirk.wordpress.com/2008/07/15/taking-sketchup-models-into-realxtend/
Introduction
This tutorial demostrates how to import 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.
Install
- Install Google Sketchup from http://sketchup.google.com/download/.
- Download 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.
Google Sketchup
- Start 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.
- 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:
- 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.
- 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.
- 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.
RexMeshTool
- 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.
- 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
realXtend Viewer
- 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:
- 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.)
Finetuning
- 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.
- 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.
|
 |