Posted by: Peter Quirk | December 22, 2008

Tutorial: Using the streamlined tool chain for importing Sketchup models into realXtend 0.4

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…

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.

positioning_model

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

Export_Selection

Step 8 – Enter a name in the popup box that asks for a name for the model and click OK.

export_name

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.

Export_results

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.

rexmeshtool_initial

  • 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.

rexmeshtool_final

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:

File_list

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.

material_panel

Dresser_final

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.

Advertisements

Responses

  1. […] July 15, 2008 Taking Sketchup models into realXtend Posted by Peter Quirk under Uncategorized | Tags: Google 3D warehouse, LinkedIn, Ogre mesh, realXtend, rexmeshtool, Sketchup, xml2mesh |   Update 12/22/2008: A new tutorial and improved process for importing models from Sketchup is now available. […]

  2. Peter,
    Thank You for your email.
    I am pleased that you chose one of my models for your tutorial. I have often downloaded models from the net to incororate them into my 3D Home Architect program, and always wished I could return the favor. Now thanks to you it has gone a step beyond. Sketchup gave me the tool to create one of the dressers in my home and now even more people will get to see and use it. Thanks again, Bearly

  3. […] on importing a model directly from Google 3D Warehouse into realXtend on Peter Quirk’s blog HERE.  Screenshot by Peter Quirk. No Comments so far Leave a comment RSS feed for comments on […]

  4. Does Sketchup work with/produced models compatible for SL?????

    TY in Advance.

  5. Apart from a very limited tool produced by Roo Reynolds in 2006, there doesn’t seem to be a single tool to do the job. If you purchase Sketchup Pro, it can export .obj files which can be imported into Second life via other tools. There is an active feature request in the JIRA database for the viewer (VWR-5534).

  6. Great tutorial. Thanks!

    “Note the number of materials. If it exceeds 12 you will have a problem assigning all the materials in realxtend”

    Some of the nicer looking models have more than 12 materials ;) I am hoping that this is easily fixable in the realxtend client.

    Also, It would be wonderful to get automatic material wire-ups with ogre material scripts rather than having to do this step manually based on trial and error. I tried replacing the UUIDs in the material script and then uploaded it, but looks like there are some problems recognizing these.

    Anyway, I am pleased with what can be achieved with your mod’d scripts and SU & reX!

    The next cool step might be to use extend realextendserver to proxy for 3D Warehouse! So we can search and realize 3D warehouse objects within an immersive environment and skip the bulk upload step entirely. I am thinking there must be some automated way to convert skp to ogremesh using SketchUp libraries or drive SketchUp itself in a headless mode on the server…(probably not very scalable)

  7. Joshua,
    I don’t know why the limit is 12, but it’s an improvement over the previous limit! (It might have something to do with the limited capabilities of the GUI and screen real estate issues when running at 800×600 resolution.

    Some have suggested that the workaround for models involving more than 12 materials is to break them up into components which can be reassembled into one linked object.

    There is talk of importing Collada and other model types directly in a future release of the viewer. A direct interface to model repositories like Google’s 3D Warehouse, the 3DVia gallery and Turbosquid would be really valuable.

    As you note, the material wire-up needs some automation. Moreover, many textures in Sketchup models are defined as colors rather than as references to a JPG texture file. These translate to techniques without texture_units in the Ogre mesh file. I just submitted a feature request to the the realXtend team to tweak the tools to generate the texture_units automatically along with their corresponding JPG files.

    — Peter

  8. […] modèles SketchUp et, pour cela, on peut suivre les instructions précises données à ce sujet par Peter Quirk. Jean-Marie Louche a signalé cette possibilité dans sa dernière “liste de […]

  9. […] December 28, 2008 Tutorial: Creating a reflecting mirror with an RTT camera Posted by Peter Quirk under Tutorial, realXtend | Tags: mirror, Ogre3D, realXtend, reflecting, RTT |   RealXtend 0.4 includes a new feature from Ogre3D that renders a scene from a particular viewpoint onto a texture. Using this so-called Render-to-Texture (RTT) camera feature we can easily create a mirror for the dresser we constructed in the previous tutorial. […]

  10. […] build or find a suitable projector and screen using the techniques described in the tutorial on the streamlined tool chain. I chose this one by Jeff and colored it with my own textures after assigning the mesh to a cubic […]

  11. How can I import models into OpenSimulator?

  12. I would like to suggest a small update to the article, based on my own perils of using this in Windows Vista: when files including sketchup, the rexmeshtools, the folder to which you are exporting or the sketchup plugin are located in an admin-req. directory (mostly just program files) then you need to make sure all programs have admin access (although best is to just not place them there).

    I encountered the following probs:
    -Sketchup needs admin to run plugin + export
    -OGRE2XML needs admin to place rexmeshfile

    It took me half an hour and some frustration to figure out so I’d be happy to save anyone the effort.

    @Robert: This only works with RealXtend viewer & server

  13. Jules,
    thanks for the prompt about the Vista issue. I have upgraded my system to Vista x64 in the past week but I hadn’t tried the procedure until you described the problem. In my setup, the only files that go into protected areas are the actual Ruby files. Everything else is stored into My Models under the user’s root directory (My Documents for XP, Documents for Vista.) I found that I couldn’t edit the config file reliably once it was placed in C:\Program Files (x86)\Google\Google Sketchup 7\plugins, even when I ran notepad.exe as administrator. It turns out the files are virtualized to c:\users\{username}\appdata\local\virtualstore\Program Files (x86)\Google\Google Sketchup 7\plugins. When I edit the config file in this location, everything worked correctly.

    I have a lot more to learn about installing software in Vista, as does the Sketchup community. I’m now working on an installer to configure and install the files with the right level of privilege escalation.

    For the record, the paths that need to be changed if you wish to use a My Models folder are as follows. (Substitute your username for Peter.)
    $g_ogre_path_meshes = “c:\\users\\Peter\\Documents\\My Models\\{model}”
    $g_ogre_path_materials = “c:\\users\\Peter\\Documents\\My Models\\{model}”
    $g_ogre_path_textures = “c:\\users\\Peter\\Documents\\My Models\\{model}”
    $g_ogre_path_xml_converter = “c:\\Program Files (x86)\\rexmeshtool\\OgreXmlConverter.exe”
    $g_rexmeshtool_path = “c:\\Program Files (x86)\\rexmeshtool\\RexMeshTool.exe”

    I also need to learn how to choose the root of these paths using the Ruby API.

    — Peter

  14. […] Tags: Ogre mesh, Ogre3D, plugins, realXtend, Ruby, Sketchup, Vista, Wix |   When I made some small modificationsto the original Ogre Mesh Exporter plug-in developed by Fabrizio Nunnari from an earlier work by […]

  15. An installer for Vista is now available. The configuration file is now moved to the user’s Documents folder hierarchy to avoid privilege execution when editing it. More info on the latest blog post at https://peterquirk.wordpress.com/2009/01/16/building-sketchup-plug-ins-the-right-way-for-vista/ .

  16. Peter,

    I’ve been able to work through all steps up to:

    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

    When you say “assign the Dresser mesh to the mesh name”, I’m assuming the mesh I just created should have appeared on this panel – which it did not. I am running Vista – could some of the previous bugs be causing my issue as well?

    Thanks

  17. hi ,
    I dont have option Export Selection to Ogre Mesh
    Or this option doesn’t appear,I am working on realXtend environment Can You tell me whats wrong with my software?

  18. If the export selection to ogre mesh is not present in the Shetchup tools menu, it’s because you haven’t installed the ruby scripts in the Google Sketchup plugins directory.

  19. Doug,
    open the 3D Models folder in your inventory before you try to assign the mesh name. You will now find that you can click on the mesh name dropdown in the rex panel and select your dresser mesh. Alternatively, you can drag the dresser mesh from the 3D Model folder and drop it onto the mesh name in the rex panel.
    — Peter

  20. hi,
    Thanks alot for your response i have solved that problem of “Export to Ogre Mesh” now i am facing trouble with RexMeshTool.When i click to export option and it takes the name and shows the tab for triangles when i press Ok ,it leads me to “OGRE Engine Rendring SetUp ” when i press Ok it gives me the following error “OGRE Exception (4:Item identity Exception): Resource with the name Sketchup default already exists.In resource manager::add at “

  21. Your “edit Peter’s config” is driving me bonkers.

    Line 47, to reflect the location of the Ogrexmlconverter looks like this in Notepad ++;

    HomeProfilePeopleMailPhotosMore ▼CalendarEventsSkyDriveGroupsSpacesFamily SafetyMobileDownloadsOffice LiveAll servicesMSN ▼HomeAutosGamesMoneyMoviesMusicNewsSportsWeather

    I did a “Find” search and could not locate key words like ogrexmlconverter anywhere in the entire config file. I feel like I have transcended idiocy, but I have to know. What am I doing wrong, besides having the breath to complain?

  22. Hi,
    Can you please tell me from which source in internet I can install these two files

    $g_ogre_path_xml_converter = “c:\\Program Files (x86)\\rexmeshtool\\OgreXmlConverter.exe”
    $g_rexmeshtool_path = “c:\\Program Files (x86)\\rexmeshtool\\RexMeshTool.exe”

    Because there are no such files in my computer.

    I already got Ruby files from
    http://cid-ea0e1d9f19828aa4.skydrive.live.com/self.aspx/.Public & put them into plugins directory for Sketchup 7. The option is showing in sketchup but no result when i use it.

    Thanks,

  23. The files are part of the rexexporttools package available from http://www.realxtend.org/page.php?pg=downloads

  24. […] Before long I had the model populated with tables, chairs, sofa, stove, a Jenn-Air appliances, Kohler fixtures and more – all imported from Google’s 3D Warehouse, most of which are exact or near-perfect matches to the ones specified.  Google’s 3d warehouse is very extensive, and carries one of the largest collection of free 3d models available.  Thanks to Peter Quirk for the Sketchup import tutorial! […]

  25. […] Before long I had the model populated with tables, chairs, sofa, stove, a Jenn-Air appliances, Kohler fixtures and more – all imported from Google’s 3D Warehouse, most of which are exact or near-perfect matches to the ones specified.  Google’s 3d warehouse is very extensive, and carries one of the largest collection of free 3d models available.  Thanks to Peter Quirk for the Sketchup import tutorial! […]

  26. Great tutorial! I am at the point that Doug got stuck – step 12. Your instruction is a little sketchy, but I finally figured out that you have to go to the File menu in realXtend viewer and choose Upload 3D model – right? But when I point that to the mesh file, I get a dialog where I can name and describe it and then hit upload, but that is greayed out, and it tells me “Unable to read 3D model”. Grrr, so close! What have I done wrong? My model directory looks very close to what you show, although the number of triangles is different. Not zero (3328 I think) but different. Any ideas? Thanks again!

  27. Dave, did you apply the realxtend 0.4 patch described in the first paragraph? It was released to fix the problem of not being able to upload a 3D model.
    — Peter

  28. Ah, never mind – I am in ReactionGrid, on OpenSim. Don’t think they have it set up for mesh import yet.
    I’ll try later, and thanks again.

  29. Yes I tried the patch
    But then a more knowledgable person came by, and said it was not implemented here or not on my server.

    I will ask around some more.

  30. Hold on – I thought I had tried the patch but i guess not. I went back and applied it. This time the upload dialog worked, and it showed “Uploading” – but at the end it gave this error: “Unable to upload [long uuid number] due to the following reason: The server is experiencing unexpected difficulties.”

    So, even closer. I will now ask the Expert and see what she says. And I will try it in Second Life also. All that headscratching leading up to this will not have been in vain!

  31. It will definitely not work in Second Life. The ReactionGrid team has talked about testing modrex, but I would think that it is restricted to a small number fo sims. Check with Kyle or Robin to see whether it is enabled on their grid.

  32. Of course, no dice in Second Life. Time to set up a realXtend server.

  33. Thanks Peter, it’s been a fascinating afternoon! And I will check with the RG folks.

  34. Hi Peter – No news from RG but I was able to launch the Rex server and with your fine instructions, import the dresser. Then I went on to create a multiple-region grid with blank (non Underwater game) regions – all with your tutorials. Now I have tackled my real goal – importing a building model from Sketchup into Rex. I have followed the same procedure but at the end of step 9 above, I get no console window, only a black screen. Task manager shows RexMeshTool and Sketchup Not Responding. It is a large model – about half a city block in scale – but that should not make a difference. Triangles are 2328, textures 23. That is over the limit but i can deal with it later if it will do the export. Any ideas?

  35. Sorry, another of those “never mind” moments. I simplified the model, tried again, got the black screen but left it for a couple of minutes. Eventually, the console came up, too large but OK to choose settings and save. I see the model in My Models. Onward.

  36. OK, I got the model into Rex! Now comes the mystery of getting the right textures assigned – and there are not just 23, there are hundreds in that model folder! Thanks for the tips. It’s an adventure.

  37. Result:
    http://www.gomaya.com/glyph/docs/Sketchup_in_Rex.bmp

    Textures are architects’ elevations. Thanks again.

  38. Good work Dave!

    This building illustrates a feature of many buildings – a pattern of frames and windows, repeating floor by floor (except for the “battlements” at the top.) If you have a photorendering of one floor, you can use the texture repeat parameter to repeat it N times vertically. Unfortunately, it can’t deal with the horizontal repitition that involves a reflection about the vertical as in your building. The battlements also make it difficult to do this with one surface, but you could do it with two surfaces (the top floor being a composite of a rectangle and the various battlements.)

    Have you seen Jon Brouchoud’s explorations with realXtend?

  39. Yes, I did see that. I think that was the first thing I saw that started me on this path. Of course he is much better at modeling than I am! And I am using all free tools. Still, it is great that design people from all levels can do this. I may prevail on our architects for some of their better renderings as textures. But my interest is creating a 3D dashboard for building control and monitoring, which does not require photorealism.

    This also means that any Sketchup building online can be brought into realXtend – not just furnishings from the Warehouse. That 12 texture limit is an issue, and I still don’t understand quite how to assign textures to the proper meshes after the import, other than trial and error – there is no way to know which slot is which mesh, and it does not drop in automatically. But to be able to do this, as simply as you have outlined, is a huge step for VWs and great advantage of realXtend.

  40. […] of the largest collection of free 3d models available.  Thanks to Peter Quirk for the Sketchup import tutorial! I left parts of the design out of the imported mesh that we were still designing, and was able to […]

  41. […] […]

  42. […] Peter Quirk’s post on Importing Sketchup into RealXtend […]

  43. […] so I imported them from Google 3D Warehouse into my Virtual Project Space this afternoon using Peter Quirk’s tutorial.  It took less then 45 minutes, and I invited some friends to tour them with […]

  44. thanks a lot peter for this useful tutorial

  45. […] with this new platform, or import 3D models.  You can import SketchUp models quite easily using this tutorial, and if you know 3D Studio, you can import just about any 3D model format, including exports from […]

  46. Hi Peter,
    I cannot export sketchup model as the exporting tools seems doesn’t work.

    When I clicked object and chose ‘export selection or Orge Mesh’. There is no dialog box at all.

    Could u please figure out which part of my setting is wrong?

    My OS is window xp sp3, sketchup7 Pro (evaluation), I did config the ruby file as you recommended. I think ‘OgreXmlConverter.exe’ and ‘RexMeshTool.exe’ are pointed correctly. However, I hardly firgure out the how to set the –$g_ogre_user_root = ENV[‘USERPROFILE’] + “\\Documents\\”

    What should I do if the user is Administrator?

  47. i finally found the way to import the 3dmesh. What I did wrong is that I use different ruby script.
    Anyway i confront another issue, which is I can import only mesh but I can’t see the material. From the tutorial, it seems that I need to assign the material again. However, I can’t see the material that come from the object at all. any suggestion?

  48. I was going through this tutorial and got stuck when applying the mesh to the cube.
    I’m able to upload the mesh. It shows up both in inventory and in the mesh name drop down list for the cube.
    However, when I select the mesh name, nothing changes. Your instructions mention I should be able to see it by this point. Also, if I try to drag the mesh over and onto the cube, it shows the circle with line (cannot do this) icon.

    Is there something fundamental I’m missing?
    I am using opensim 0.6.6 with modrex on a linux box. I am logging in using realxtend viewer 0.41. Any suggestions?


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: