Unity Tip: Using Second Life As A 3D Modeling Package

Unity Tip: Using Second Life As A 3D Modeling Package

Hi everyone,

You may need to use 3D modeling to create objects for your project but do not have the technical experience yet to do so, or find that your package of choice does not provide the feature that you need (for example, creating spheres in SketchUp is very difficult).  There is an alternative, user-friendly solution though.  You can create your objects in the online virtual reality world Second Life 

http://www.secondlife.com

Second Life is accessed using "viewer" software, a program that connects to the online Second Life servers.  The owners of Second Life, the company Linden Lab, support the creation of third-party viewers by developers.  Some of these, such as the very popular Firestorm viewer - http://www.firestormviewer.org - enable objects that you create in Second Life to be exported offline as Collada / .dae format XML data files.  

The exported model file can then be imported into Unity, or into a 3D modeling package such as SketchchUp to perform additional editing, and perhaps also conversion to a different model format such as .fbx or .obj, before finally importing into Unity.  Here's how to do it.

STEP ONE

Open a Second Life viewer that supports Collada fikle export, such as Firestorm.  Find a place to build your object.  If you do not own land in SL, you can find a free public "Sandbox" construction area to work in by opening the world map window and typing 'sandbox' into its search box.

STEP TWO

As an example, we will create a simple sphere for export.

When you have found a location to build in, right-click on the grass to bring up a "pie" menu and select the 'Create' option from it.  this will open a pop-up window that offers a selection of basic object shapes.

STEP THREE

Left-click on the shape that you want to use - in this case a sphere - to highlight it.

Then move the mouse cursor outside of the pop-up window and left-click on the grass to create a single instance of that object. Doing so also automatically enables the editing options in the 'Create' window.

STEP FOUR

Right-click on the object to bring up its pie menu.  Left-click on the 'More' option to browse through the menu items until you see an option called 'Save As'.

Select the 'Collada' sub-option.

Select the format that you want the object's textures to be saved in (for Unity, we recommend PNG) and click the 'Save As' button.

A Save pop-up will open, offering to save the object as a .dae format 3D model data file with the default name 'Object' (you can change the name to whatever you wish).

A pop-up message in the top corner of the Second Life window will confirm that the save was successful.  Browse to the location on your computer where you saved the file to confirm that it is present.

STEP FIVE

You now have the choice of whether to import the model file into Unity immediately or do some further editing in a 3D modelling package such as SketchUp first.  Since the reason that a developer might choose to use Second Life for modeling in the first place is because they do not want to use the likes of SketchUp, we will first demonstrate how to import the file into Unity.

Open your project in Unity and go to the 'Assets' panel.  Import the .dae file into Unity, either by dragging-and-dropping it into the 'Assets' panel or by right-clicking on the white-space inside the panel to bring up its menu and selecting the 'Import New Asset' option.

The .dae model file will now appear in the panel, with a preview of the model shown to the side of the panel.

STEP SIX

To use the object in your project, hold the left mouse button down on the object file in the 'Assets' panel and drag-and-drop it onto the central construction panel.  The 3D representation of the model file will appear in the central panel when the cursor enters it, and you can move the mouse around to position the object.  When you are satisfied about where you want to place it, release the left mouse button.

You have now imported your first Second Life-created 3D model into Unity!

If - as is likely - you want to create more complex models in Second Life from multiple parts, you can do so easily.  

(a) Once your object is completed, right-click on one of the pieces to bring up its pie menu and select 'Edit'.  

(b) Hold down the left mouse button and move the mouse to draw a box around the collection of objects that highlights all objects within the box's boundaries.  

(c) Finally, whilst all the objects are highlighted, go to the 'Build' option at the top of the Second Life window and select the 'Build' menu option, and its 'Link' sub-option to join all the pieces into one object that can be exported as a single model file.

STEP SEVEN

Alternatively, you may wish to import your .dae file into a proper 3D modeling package for further editing before you import it into Unity.  In this guide, we will use the SketchUp package as our example.

EDIT: We found in later testing that importing the .dae model directly into Unity and skipping editing the file in SketchUp made the model's textures and 3D surface smoothness mirror the original SL model's much more closely (for example, our SketchUp-Edited model had much darker textures after Unity import, whereas the .dae model we had just exported from SL was rendered perfectly in Unity).  So you may find it is better to just load the original .dae model into Unity and skip modeling packages altogether unless there is an edit you really need to do that is only possible in such a package.

EDIT 2: We also found that when a complex multi-piece model made in SL (such as the full-body character shown in the image below) is imported directly into Unity without editing it in 3D modeling software first, the Unity hierarchy lists each individual component so that you can edit it.  This is tremendously useful.  The components are listed as 'prims', as this is what individual objects in SL are called.

And now back to our guide ...

Original text

Start a new SketchUp project.  right-click on the default human reference object to bring up its menu and select the 'Erase' object to remove it from the construction stage so that you have a completely clear space to build (otherwise the figure will be incorporated into your model file when you export it again).

Go to the 'File' option and select the 'Import' sub-option.

A file-browsing pop-up will appear.  Before locating your .dae file, left-click on the 'Options' button and ensure that both the 'Validate .dae file' and 'Merge coplanar faces' options are ticked.

Once this is done, select the object file and click the 'Import' button.  Your Second Life-originated model wil appear on SketchUp's construction stage.  Success!

STEP EIGHT

You may find though that SketchUp's interpretation of the model data has rendered it in a somewhat angular form compared to the perfect sphere that we had when we imported it directly into Unity.  This can be corrected though.

When importing Second Life objects into Unity, an interface will be shown to the side of the screen that you may not have seen before when creating objects from scratch in SketchUp.  A 'Soften Edges' option enables you to smooth out the angles by using a slider to soften the angles, up to a maximum of '180' degrees.

The object's surface updates in real-time as you move the slider.  Note that the further the slider is increased, the more 'faces' that are generated on the model.  Having thousands of faces on an object may slow down Unity when the object is finally imported into your Unity project, so the ideal approach - unless your model needs very high visual fidelity - may be to go for a mid-range position such as '90' on the slider, or however far the slider has to travel before the model surface on the real-time preview is smoothed out to your satisfaction.

Once you have identified the angle-smoothing setting that you want, right-click on the object to bring up its menu and select the 'Soften / Smooth Edges' option to complete the smoothing process.

 

STEP NINE

Once you are ready to export your SketchUp model, go to 'File > Export > 3D Model'.

A file-browser pop up window will appear.  Before you do anything else, click on the 'Options' button and ensure that the 'Triangulate all faces' and 'Export two-sided faces' options are ticked.  

Whilst these may not matter when exporting a simple object such as a sphere, if you later create more complex objects in Sketchup - especially hollow ones - then having these options enabled reduces the likelihood that your model will have broken or missing sections on its surface once it is imported into Unity.  You only have to apply these settings once and then they will be used for all subsequent creations

When the options are selected, click the 'OK' button to return to the main file-browsing window and left-click on the drop-down menu beside the 'Save as type' option to choose the 3D model format that you would like to export your object in.  For Unity, we always use 'fbx' as our personal choice, though Unity supports all of the major 3D model formats such as dae, fbx, obj, etc.

Finally, click the 'Export' button to export the model in your chosen format to the location on your computer that you selected in the file browser.

A pop-up will confirm that the object has been exported successfully.

STEP TEN

Go to the location on your computer where you exported the model to.  If you use textures in your SketchUp project, you may also find that an additional folder with the same name as your project has been created that contains the textures for the model.

The process for importing the model into Unity is exactly the same as the one we used earlier in this guide to import the .dae model.  Open your Unity project and import the model file (and also the folder containing the textures if there is one) into Unity's 'Assets' panel, and then finally drag-and-drop the model onto Unity's central construction stage.

If you have any questions about this guide, please feel free to ask them in the comments section below.  Good luck!

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.