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 was wondering, if it is going to be a difficulty writing an export mod from ‘SketchUp’ to ‘SecondLife’… would it be easier to export object files created from SketchUp to another external program? For exsample SketchUp to Blender?

  2. I have used Blender to get from SketchUp Free to 3DS many times. If Blender will export to SL, that’s all you need, and Blender is free. If SL will import 3DS or there are free 3DS-to-SL converters, it’s extra steps, but still easy.

    I hope this helps,
    August

  3. Ok, not it’s not broken. Therefore …

    This seems like a good place to announce that I have written a tool called Sketchlife, that can be used to model in SketchUp, and upload to Second Life using an easy, wizard-like process. It took a lot of time to get right, but I have also spent an enormous amount of time testing it, so it is by now quite a solid tool.

    If you would like to get to know it, there is comprehensive information, including videos and detailed documentation of each of the tools, and the process, on the following website:

    vrshed.com/sketchlife/

  4. Further on to the above …

    In the context of this article and comment thread, I would like to say that:
    – As Chip Poutine points out above, SketchUp is a state-of-the art tool with intuitive inferencing and snapping capabilities. It is available free, thanks to the financial mammoth that is Google: they bought it and made it free to help populate Google Earth with user-created content.
    – Lining up prims in SL is a major nightmare.
    – However, after doing some comparative assessment of SL and SketchUp, I came to the conclusion that any automatic conversion from SketchUp, or any other mesh-based too, into simple SL prims, is doomed to not work for a model of any non-trivial complexity (anything other than rectangles and certain types of triangles). What can be seen in the third image on the top of this page cannot be improved upon – using simple SL prims.
    – Using sculpted prims for this can be made to work, but such a tool does not exist at this point in time.
    – Hence Sketchlife was written to allow a user to re-express a mesh model using SL prims. Judgement and common sense are required in how the prims are placed – this is something that cannot be automated in software – but the models will appear in Second Life exactly as seen in SketchUp. Textures are supported, they will be mapped exactly, except for curved faces of cylinders, which will be mapped approximately only. However, note that most prims in buildings are Box-type prims.
    – Sketchlife is aimed at buildings. Organic shapes are better made through the use of sculpties.
    – This is similar to what Wilfred was talking about earlier in the thread, but the important thing to stress is that the tools used to make prims in SketchUp/Sketchlife are different and are much easier to use, than those found in the Second Life Viewer.

    As an example of what can be done, I have imported the model of Saint Basil’s Cathedral from Google Earth/SketchUp into Second Life. Here is a screenshot of it inside Second Life:
    http://vrshed.com/sketchlife/examples/vasiliy_018.jpg

    Evgeni
    (Mrs Brandi in SL)

  5. (To anyone else who is experiencing difficulties posting here, it seems that comments are only accepted if they end with an extension like “.html”.)

  6. Evgeni Sergeev has worked out out a brilliant solution (called sketchlife) to this problem, by creating a set of free tools (ruby scripted plugins) that you simply load into sketchup, that enables the modeler to create equivalent prims that are then imported into second life…see the video at http://vrshed.com/sketchlife

    Currently you need users need to pay for the service set to L$1 per prim + L$1 per each textured face on each prim inside Second Life.

    The most impressive demonstration of the power of sketchlife is the increadible St. Basil’s Cathedral, originally modelled by Arrigo Silva and featured on Google Earth.

    Teleport: click here (this is a SL-URL).

  7. Hi Anthony, just a note that I changed the price to L$1 per prim (no extra cost for texture) after some experimentation. It should now be cheap enough for everyone.

  8. Hi Ms Brandi, ive imported a couple of my new architectural designs into second life with your application, and it works like a charm…I can walk my clients through my virtual spaces now…without the hassle of learning SL modeling, which was seriously freaking me out.

    cheers Bro!

  9. sorry Mrs Brandi….not Ms.
    Hey if we import more polys using sketchlife do we get a discount?

  10. Any chance sketchlife can be supported on other grids as well, such as OS Grid which is based on open simulator?

  11. Very nice, I love using Sketch up as well as other 3D programs but the export on most is so damn stressing it makes you want to punch your computer. Tack Wings 3d for example, every uv map I have made has turned out looking lick crap in Second Life and other programs you get lost in, some tack up to much space on your computer and the good ones do not let you export, convert, or import and a few are made for a sirten kind of computer. I knew that Sketch up pro could upload to SL but I don’t want to buy it ether as well as other 3D programs. I always wondered if there was a way to export Sketch up models to SL, I wanted to make a way myself but I do not have the skills to do so. I think it is pretty damn cool that you found a way to do it. I look forward to see how far you get with it. Good luck:)

  12. Lindelof and Cuse should be embarrassed. They pandered to our basest emotions and gave us an absolutely hollow piece of religious allegory in place of an actual story.

  13. With the introduction to mesh to Second Life, my understanding is that importing will be possible. Mesh is currently in beta testing. Let me know if anyone has tried it yet.

Comments are closed.