Google Sketchup -> Second Life export

SketchUp is great. Not only is it free, but it supports Ruby as a scripting language, and provides plenty of interesting APIs and reasonable (though not very well inter-linked) documentation too. It’s long been discussed, in conjunction with Google Earth, as a potential virtual world, and rival to Second Life. While it will be fascinating to see how that develops, and whether they become more comparable over time, what interested me much more in the short term was some way of getting 3D data from SketchUp into Second Life. Dave did this recently with PowerPoint, which and it reminded me just how much I wanted to do the same thing in SketchUp.

What I really wanted was SketchUp -> Second Life exporter. I didn’t want to buy SketchUp pro (though I thought about it), because even that wouldn’t solve my problem. More recently, I saw that Blender 2.4.2 makes it possible to import SketchUp’s (proprietary, binary) .kmz file format. This is cool and potentially very useful, especially when you consider the Prim.Blender project allows you to draw SL prims and export them. Ideally, it would also do the hard work of creating simple SL style prims from the complex 3D data. This is not an easy project though, as discussed at 3pointD recently.

Eventually I gave up my search for a basic SketchUp -> Second Life exporter and realised I was going to have to write one. I’m really not a Ruby guru, but I surprised myself by knocking something up in 20 lines and no time flat. Ok, so it’s not very good, and it doesn’t bring us any closer to the nirvana of complex models being automagically generated using the minimum number of prims, but it was so easy that I’m very surprised not to be able to find anyone else taking this approach already. (Perhaps someone will fill me in it has already been done and I’ve simply missed it.)

Importing into SL as a notecard

So, what is it?

What I wrote was a short Ruby plugin for SketchUp. It writes out basic model information to a text file, allowing it to be imported again (as a notecard) into Second Life. From there, an object parses the notecard and re-generates the model in-world. It does not support the full power of SketchUp by any means, and takes some judicious short-cuts to avoid generating zillions of prims. In erring very heavily on the side of simplicity, I’ve made something that you’ll either find delightful or frustrating. Each face in your SketchUp model, you end up with a flat, rectangular prim which represents the bounds of that face. Imagine if every face of every shape in SketchUp was simplified down to a rectangle which marked it extents. That’s what my script does. It’s not perfect, but it’s a start. The interesting bit of the Ruby plugin looks something like this…

model = Sketchup.active_model
file = File.new("/testfile", "w")
model.active_entities.each do |entity|    
   if entity.typename == "Face" #ignore everything but faces 
      # (e.g. we won't pay any attention to edges, points, etc)
      face = entity.bounds # For now, make a rectangular prim
      ...
...

While it works very well for fairly basic models…

SketchUp - SL export (simple)

Something more complex ends up being made to look fairly ugly. Curves and non-regular faces are particularly badly hit…

SketchUp - SL export (complex)

Future developments will include colour/texture support, as well a bit more thought about the mapping between the SketchUp model and Second Life prims. I’m sure there are loads of things that can be done to improve it. I’m already enjoying it as a faster way to put simple things together though.

123 thoughts on “Google Sketchup -> Second Life export

  1. I’m not aware of anyone trying to get SketchUp to export to SL, so you may be out there on your own. However, I’m sure there are plenty of people who will take a closer look at SketchUp if the conversion goes well; Blender’s UI is still considered it’s weak point (which makes me wonder why no one is creating a new UI; it’s open source after all).

  2. Pingback: 3pointD.com

  3. Pingback: menti.net » links for 2006-09-29

  4. I concur with csven’s comment about the Blender UI. As significant an achievement as prim.blender is, it still seems easier to model online in SL and archive the effort locally with OGLE and GL intercept.

    SketchUP, on the other hand, offers some tremendous enhancements with its (largely) intuitive inference and snapping abilities, at least with the Pro version (haven’t tried the free version yet). This means that it is easy to extend a face of an object to line up perfectly with faces or points on other objects without requiring use of a grid or keying in values – my primary frustration with SL’s tools.

    The challenge going forward might not only be the replication of more complex forms, but also working with SketchUP’s personality as a ‘surface’ modeler versus the ‘solid’ qualities of prims. While it should be easy to import a cube as a single prim instead of six, it may get a little hairier with other forms borne of SketchUP’s tendency to glom objects together (if one is not dilligent with the use of components and groups).

    Still, this is a fantastic accomplishment – consider me both a drooling fanboy and potential beta tester!

  5. Thanks for the feedback everyone.

    Some very insightful comments Chip. I’m hoping to at least be able to parse the SketchUp model into prims in the ideal cases (especially important for cylinders, as the above screenshots demonstrate). Even just working with faces, once you get used to thinking about how SketchUp works, is quite useful though.

    I’m travelling next week, but I’ll try to get it into a state where some more people can have a play with it soon.

  6. I’m an enthusiastic SketchUp user, and I’d love to be able to use it for quickly building things that are difficult using Second Life’s native interface. Even simple output of faces would be great if this preserves the relative vertex points. My usual problem is building something composed of simple forms that meet at really odd angles, and SL’s lack of a simple way to abut objects to each other on faces or vertices means I spend an awful lot of time doing math, when I’d rather just have my objects snap to each other the way SketchUp does.

    Looks like it’s time for me to poke around in the SketchUp Ruby API. If it’s really that simple, then this could be a fantastic way for me to generate some of the weird structures I love to build without spending hours pondering how to do it in the SL interface. Thanks for taking the time to write about your progress so far.

  7. Eleanor: I’m not entirely sure what you mean. Second Life (which is not really a game, but more of a virtual world) is available from secondlife.com, and you can ‘play’ for free.

    Chandra: I am very much a beginner in Ruby (which is a lovely language by the way). I recently attended RailsConf Europe, which reignited my interest in both Rails and Ruby. My plugin doesn’t (yet) even handle faces at weird angles. When I’ve solved that one, I’ll put up an update. You should absolutely try out the SketchUp Ruby API. It seems pretty comprehensive, comes with lots of examples and is well documented. Let us know how you get on too!

  8. Pingback: Data chains between virtual spaces at Metaverse Territories

  9. Pingback: Jeff Barr’s Blog » Links for Monday, October 2, 2006

  10. Couldnt you build a component library of SL prims in Sketchup (cubes, cylinders, prisms etc)? The exporter could use these components to more effeciently build SL models, instead-of/in-addition-to just building SL polygon prims from the faces…

  11. Pingback: From eightbar to Slashdot « The lost outpost

  12. Pingback: GameTomorrow » From eightbar to Slashdot

  13. Pingback: Sketchup to Second Life export

  14. Wilfred: yeah. Using pre-canned prims would make life easier for the exporter in so many ways (I don’t know if you’ve ever used Prim.Blender, but it takes that approach). I wanted to make a generic exporter though, since It defeats the flexibility of SketchUp to enforce the use a palette of prims.

    On the other hand, this Slashdot commenter is right. It is incomplete and it will be very hard to go beyond faces in cubes. The biggest problem (efficiently converting from vertices to prims) is no closer to being solved.

    I’ll share some code once I’ve fixed the major bugs. F’rinstance, while rectangular faces are exported, it currently only works well if they are cleanly on the x y or z plane. Anything rotated ends up being represented by a bounding box due to a pretty naive implementation. No wonder it was fast to write. πŸ™‚ I’m travelling this week, but when I get the time to fix the biggest problems I’ll put up an update.

  15. Pingback: Marc Melvin’s Weblog » Blog Archive » Second Life Import Tools

  16. Can’t wait for this Andrew. Fairly new to SL I have been importing my real life fashion into the Metaverse. I am begging you please bring in the curves!!!

    Thank you for your drive to create a cooler world!

    Amazing !!!

  17. Pingback: baroquedub » Blog Archive » Google 3D

  18. Pingback: The Meshverse Journal » The Real Value Of YouTube

  19. Pingback: Donnagh McDonnagh » Blog Archive » links for 2006-11-11

  20. Pingback: eightbar » Blog Archive » Matt Biddulph’s virtual 3D printer

  21. Pingback: Kitten Lulu » Blog Archive » Copybot: LibSL’s GLIntercept for objects « Talking To My Self - Sue Baskerville

  22. I am more interested in using non-related software. I have used the
    AutoDesk software before and all i can say is..in comparison to the SL editing program…SL’s is the worst that i’ve ever seen… thats mostly because I currently have a copy of 3ds Max9 which is one if not THE best all around 3d model creator and editor available to the public.

    I just cannot stand the SL editing sytems single sighted editing…not to mention single polys cannot be touched so waht would only take on object takes 6… and i have no clue how to group objecs, while i havent worked with the system very long its been long enough to say i cansee why its free…well can be free

    If anyone figures out how to Import models into SL from a different program please e-mail me @ Balltrocity@aim.com or just post it here, cause i dont always get all my e-mails

  23. I have also been looking all over for some kinda download link for this. As this blog seems to have the most recent posts I am posting here as well that if the exporter could be emailed to me, or a link to download it from that would be great. I am getting into building and would like to be able to not only do basic drafts external to the game but be able to upload atleast a framework to construct the actual building by.

    And I understand that right now if I create 1 cube in Sketchup and import it into SL that I will get 6 flat cubes placed to form the 1 cube I made, but thats fine. Easier to edit then create.

  24. Pingback: The Meshverse Journal » InformationWeek Sees The Light

  25. Would you be willing to share your ruby script so other might try and improve on it?

  26. Hey there! Could we talk plain English and let us know what we need to do to make it easier to design and build in Second Life please.

    Roo’s original entry was what drew me to this discussion forum and I got lost along the way and I’m no wiser.

    Pleae tell me what I need to do in Sketchup in order to export to Second Life.

    CC

  27. Well, I am not a Ruby developer myself, nor a linden script one. I was a former C++ programmer, and I am quite fast to learn. I am experimenting with Google SketchUp in this period and I am interested to support you in your project to improve. In case you are interested, please, contact me. My SL name is Eadoin Welles

  28. Pingback: Google SketchUp 6, crea il tuo mondo » downloadblog

  29. I build and model with both Sketchup and as of late Second LIfe. I am very interesting in helping this move forward any way I can. I am aware of the challenges faced in creating prims(the standard name for basic shapes in Second Life) for large scale applications. I am interested in finding ways of building in Sketchup and getting an accurate fascimile in Second Life. If I can make a suggestion, the person at Google/Sketchup who wrote the kml exporter and someone from Linden labs involved in the builder interface would probably be able to advise enough on this topic to make an open source plug-in a reality.

    Please let me know if there is anything I can do to advance this project.

  30. Also interested in trying this out. Please let me know (by mail perhaps?) if I can do anything to help test and debug this fascinating piece of work πŸ™‚

  31. Pingback: MondoBlog » Blog » Le ultime notizie dal mondo virtuale di Second Life - 06/12/06

  32. Hello, I am an archtiect and I use SL frequently and I am have a hard time using SL modeling software. I use sketchup occaisionally but I would definately like use of this to import some of my building designs into SL.

    Thanks

  33. You guys are great!

    I too am an architect and don’t really want to relearn a different modeling software. I use Sketchup Pro and Revit, and now find SL as a great new entertainment medium, with great potential. So a google search turned up this page…

    Keep it up, I’ll gladly pay you $1000 for the tool set…. I did say in SL$ didn’t I?

    Are you all ready for Autodesk Island?

  34. I have been watching this for a while, I am highly interested in some way to import from outside of Second life. I primarily use Cinema 4D and Maya, though I have played around with Sketch up here and there. I also would be willing to put some L$ towards a toolset.

  35. Wow, I started my morning by doing a Google search using the words “mesh, Second Life and 3ds Max” and all of a sudden I’m here – discovering things like ScetchUp for the very first time. Originally all I wanted to do was find a way to test my skins and clothes on a Second life body mesh using Max, but now my mind has expanded to much much more after reading all this interesting information. Just downloaded ScetchUp and will try out your plugin – thanks for the effort!

  36. hi,
    just theoretically:

    to prevent undesired results, i would prefer or do it this way:
    construct in max, use “STL Check” modifier (used after boolean and similar operations in the GameDev to prevent Errors in geometry (seperated vertex etc)), export as OBJ/DXF and user your way further…

    i bet the geometry may be exported correctly then..
    i ll give it a try later.
    thanks for your work
    regards

  37. Pingback: SL… a new world needs new tools at Andre Schuster | Design und Inhalt

  38. Roo Ive almost cracked aVectorworks import, can we chat sometime?

Comments are closed.