Import SketchUp Models into Blender - extras, options & issues
Although SketchUp is relatively straightforward to use, content tends to be produced using a lot of duplication, of surfaces, materials, objects etc. For game models this can be problematic because it results in a large amount of redundant material. This often means SketchUp models cannot be used as is after exported, which in turn tends to require they be cleaned and better (manually) optimised before re-export to an appropriate format.
As briefly mentioned in the introduction, SketchUp models are constructed using a lot of duplication; duplicate surfaces, duplicate materials, textures, UV maps and so on. Whilst this allows for both the inner and outer surfaces of a given mesh element to be textured with relative ease and independently of each other, it tends to be problematic outside the SketchUp environment because the applications is essentially generating too much mesh data for models to be used in game 'as is' - using SketchUp content directly would mean game engines rendering a lot of redundant material unnecessarily, largely because its hidden from view. And whilst SketchUp does provide a number of export options they don't necessarily address this issue of over duplication directly (as it relates to game content), so content often needs to be further edited and optimised in more meaningful ways in Blender or other applications.
Shown below for example is a section of a SketchUp building after import into Blender; although all five window sections are UV mapped using same bitmap image (a glass block - not transparent), each has its own individual Material reference. In other words five distinct and separate Materials referencing the same Texture/Image data. In addition to this, for SketchUp to texture both sides of each window it has to duplicate and invert the mesh, creating a 'front' and 'back' (or 'inner' and 'outer' surface) that, alongside individualised Material assignments, can then be textured independently if required - double-sided in other words. Whilst this duplication may not be an issue in its own right, if the Window has thickness - it's not just a single planar surface - this can mean SketchUp has actually drawn four or more surfaces - an outer and inner surface for each 'front' and 'back' plane. And as each of these is a completely separate object, the net result of all this duplication is that SketchUp imports can contain hundreds of mesh items where one or two might otherwise have sufficed.
Design note: overall most issues attributed to cleaning up imported SketchUp models relate to this fixing or addressing the over-duplication of mesh data.
SketchUp doesn't collapse objects into larger units in any meaningful way even if they may have a common element between them. The windows shown above all reference the same texture, but each pane is exported from SketchUp as a separate Object assigned a separate material. This has advantages inside SketchUp but not necessarily in other contexts or 3D applications where this structure represents a lot of duplication and waste
Double-sided meshes then are an issue and need to be cleaned before a model can be used in game. The particular problem with duplication is that meshes are co-planar, the 'inner' and 'outer' surface of an object sit back-to-back occupying the same coordinates in space, the only difference being face normal's direction/orientation (faces one way or the other relative to the screen). This can be tricky to manage where such surfaces belong to the same object and are without independent material assignments (which would make for easier selection and manipulation).
Design note: as a general rule-of-thumb games and 3D applications in general draw surfaces single-sided. Where both an 'inner' and 'outer' representation are needed they tend to favour simple duplication and inversion of primary surfaces (indicated by surface normal direction). Blender defaults to this approach for all surfaces. Alternatively where the ability to draw different surface textures is needed, the primary mesh will be duplicated but then assigned individualised materials. SketchUp tends to favour this approach.
Having said this however, most duplication can be eliminated indirectly by collapsing coincidental vertices using "Remove Doubles". To do this, if objects are not double-sided by themselves join opposing meshes together, "Ctrl+J", into a single object (joins 'front' and 'back' facing Objects of the same structural element into a same Object). In Edit mode select the entire mesh and from the "Remove:" subsections of the Toolshelf ("Tools" tab, Blender 2.70+), click the "Remove Doubles" button. This will merge coincidental vertices, collapsing surfaces into single-sided meshes in the process.
Design note: although "Remove Doubles" is a relatively quick way to address the problem, it can result in incorrectly inverted faces as a result of Blender not being able to properly determine their orientation. When this happens selective use of "Recalculate" or "Flip Direction", available in the ToolShelf under "Shading / UV's", can fix the problem by correctly reorienting surfaces. For more on double-sided meshes click here.
For SketchUp to accommodate texturing on both sides of a mesh it duplicates and inverts polygons leading to there being a lot of co-planar surface repetition that has to be dealt with once imported into Blender - after removal of surfaces using "Remove Doubles" some remain inverted and need to be flipped accordingly
Mesh duplication also typically means material duplication, often despite several items being mapped with the same image. This is done to allow surfaces to be differentially textured, i.e. a different texture mapped to the respective 'front' and 'back' of a given structure. As with object duplication however, this generates a lot of redundant data that ideally needs to be removed.
Design note: in practice this might mean that a simple cube for example might have the same brick texture assigned to all sides making it appear as if each surface references the same underlying material when the opposite might in fact be true. For SketchUp, whilst each side is mapped the same image, the underlying material references are separate, allowing each to be textured differently. This works for SketchUp, but for game content it leads to a lot of unnecessary duplication that can be better optimised and controlled.
After joining meshes together, "Ctrl+J", and with an object selected in Object mode, use "Material" Properties to manage unnecessary assignments by LMB selecting an entry in the "Material Index" preview section (the small area showing a list of materials) then clicking the "-" button immediately to the right to remove. The mesh will update, and likely change colour, indicating modification has occurred. Or similarly, select the object and then a Material reference to be removed in the Material Index, finally clicking the "X" button below (to the right of the "Material Name" input field below the Index list) to delete.
Design note: the mesh will change colour when removing redundant Materials based on the "Diffuse" colour of any remaining assignments - or grey where none exist. Also when looking at the materials, aside from the datablock itself, the number of users is also shown giving an indication as to how many other mesh objects are 'using' the same data. Bear in mind that in the final equation the number of materials assigned to a given mesh will be determined by target technology and whether multiple (or 'multi-') materials are tolerated - games that can't handle multiple materials will tend to assign the first instance found to an entire mesh, which then may assign textures incorrectly as a result.
SketchUp works so each surface can be textured differentially with relative ease. Once imported into Blender Objects are revealed to have separate material assignments even through they reference the same texture resulting in material data duplication
Once meshes belonging to the same object are joined together, material duplication is more evident - on complex models and structures this can result in dozens of references that are otherwise textured with the same image. These should be removed or optimised relative to target technology
Unnecessary material references associated with previous section of the same object are removed leaving a single material instance. This can then be done to the entire mesh, condensing materials removing duplicates to better optimise the overall models datablock structure
Joining meshes together also results in multiple UV map associations, so where complex items are concerned, what becomes a single item will have several, if not dozens of channels, each uniquely identified. This can cause some confusion because even though a texture might already be assigned it might not appear on the mesh unless the respective UV Map channel is active (selected). In addition this behaviour also means when reassigning textures, even though UV's themselves may appear in the UV/Image Editor, nothing will appear on the mesh, again because the UV Map channel associated with the texture is not active. In consequence the same texture will need to be assigned to multiple UV Map channels, or redundant channels need to be removed. This can be done in "Object Data" properties within the "UV Maps Index" manager (lists all UV Maps associated with a selection). Simply LMB select each unwanted entry, leaving at least one, and delete by clicking the "-" button to the right of the list.
Design note: deleting redundant channels is preferential because game engines tend to have a limit on the number of UV Map channels a mesh can use, typical one, or two where the second acts as a layer for lightmaps or similar. Deleting channels can be done in both Object or Edit mode.
When a series of objects are joined together the result tends to have more than one UV Map channel because each Object has a unique UV Map ID (name reference). As a result instead of collapsing into a single UV Map reference ("UV Map"), resulting objects tend to have multiple channels that will need to be removed leaving at least one (or two where the seconds holds lightmap data)
When content is exported to dae it also includes information concerning scene 'scale' and the 'unit of measurement' used. During import, Blender utilises the same data to set its own measurement system relative to the originating program, SketchUp, ensuring the same or similar scale and unit references are maintained between applications.
Design note: as DAE files are text based they can be opened into plain text editors (NotePad). Usually at the top of a SketchUp export is the specific metadata 'tag' referencing the unit of measurement, for example;
<unit meter="0.0254" name="inch" />
Technically what this does is set the unit size relative to a whole unit, "1.0", so for example an "inch" is measured as being "0.0254" of a metre ("1.0"). In this way it is then possible to represent different scale values/units of measurement, Imperial in particular, as decimal fractions - inches and feet can be decimal fractions of 'yards', or centimetres as fractions of metres and so on. Additionally note that all measurement is based around "0,0,0" grid centre and their respective vertical and horizontal planes.
Whilst the specific declaration is generally always present on export from SketchUp, it's optional and can be omitted if "Import Units" is not selected during import; the affect of this in Blender is to determining how content is scaled and distances interpreted. In other words, absent the 'unit' metadata, meshes will be scaled relative to units of measurement being considered at face value. For example, a standard internal door for a residential property (door to a bedroom) is typically 6' 6" high by 2' 6" wide (six foot six inches high by two foot six inches wide), in terms of 'units' this is simply "6.5" by "2.5", a decimal number; they don't become 'feet' and 'inches' until that specific type of measurement, 'Imperial', is set against a unit scale. For Blender, this means without "Import Units", models import using the default unit of measurement being "None" and Scene at "Scale: 1.0" (default for "None"), which result in models appearing comparatively small. Although Scale can be set after-the-fact, preference should be given to the re-import the dae file with "Import Units" set to ensure scale and units of measurement correspond appropriately.
Design note: when importing a model preference should generally be to using "Import Units" to ensure proper scaling of the model, doing so after the fact can cause issues because there are physical differences between meshes with and without units set at import. If "Units" needs to be set after import it can be done from "Scene" properties as normal. In addition to units and scene scaling, adjustments may need to be made to grid settings and camera clip distances depending upon the size of the model being imported - although scale is set, very large models may clip the maximum camera distance and disappear from view. To adjust the former, open the "Transform" properties panel, "N", and scroll down to the "Display" sub-section, change "Lines:", "Scale:" and "Subdivisions:" as needed (and available). For the latter, in "Transform" properties panel again, scroll down to "View" and "Clip" sub-sections; alter the values appropriately so the mesh can be seen as required (note the distance may max-out based on a hard coded limits and not extend as wanted). For more information of Blender's "Units" click here.
The difference between a model from SketchUp imported with and without units set up - in affect without reference to the 'type' of units, i.e. "Imperial" or "Metric", Blender will interpret measurements at face value - 6.5 not being feet or metres, but as 6.5 "Blender Units", making it just a little larger than the default Scene cube (which is 2x2x2 units)
Without "Import Units" set during import of the Collada file, the mesh will appear relatively small in Blender. Shown for example is Blender's default Scene cube relative to the imported dae mesh (note "Units" properties are set to "None")
With "Import Units" set, Blender will bring in the SketchUp model using whatever units of measurement were set in SketchUp - "Imperial" in this instance (note the default Scene cube, selected where the 3D Cursor widget is located, appears relatively small when Blender's "Units" are correctly set)
By default SketchUp models are aggressively optimised and (pseudo) 'game ready' on export because it's assumed content is going to be uploaded to Google Earth or other 'real time' service that makes use of KMZ or DAE files. In other words, notwithstanding previous points, meshes are reduced to as minimalist a structure as possible before then being triangulated (tessellated) for rendering efficiency.
Design note: because SketchUp uses Boolean addition/subtraction operations to generate structure, small fragments can form where surfaces or edges are not properly aligned or snapped together. This often results in small thin triangles that might otherwise be considered unnecessary or potentially problematic (inefficient) for rendering in game.
If further work needs to be done after import into Blender this can be difficult because triangulated forms are not especially conducive to being edited or altered due to the way they forces cuts and splits to terminate at (corner) vertexes rather than enabling those same cuts and loops to propagate across surfaces. To mitigate this problem the triangle 'soup' should be converted to "Quads" (or "Ngons").
Design note: quads and ngon imply surfaces comprising two or more individual triangles - a surface bound on all sides by at least four edges, four vertexes, one in each corner with a diagonal (unseen) edge corner to corner (which can be 'turned'); Ngons effectively use more of the same depending on shape complexity.
To do this, in Edit mode either "Shift+RMB" select a pair of triangles, or the entire mesh ("A"), and press "Alt+J" (or from the 3D View header menu click "Mesh » Faces » Tris to Quads"). Selections will immediately convert to quads/ngons.
Design note: when selecting triangles they will generally need to be 'planar' - surfaces that sit along the same flat 'plane' - else "Join" will not work without adjusting "Max Angle" tolerance in "Tris to Quads" options (appears at bottom of the ToolShelf when the feature is used - may need to be revealed clicking a small "+" symbol), or making adjustments to the mesh structure itself. The conversion process is automatic and 'best guess' so can result in invalid or malformed surfaces.
It's preferable to perform this step after the Scene has undergone some basic clean-up to move, delete or collapse unwanted material else it can cause additional issues that need further work to address.
Design note: because much of the models content is 'co-planar' it can be removed as outlined above through the use of "Remove Doubles". Else material can be moved to unused layers using "Layers" manager - select an object or objects then press "M" to open the "Layers" manager, click a button representing an unused layer (layers with content display a small orange dot). Content will immediately move upon clicking. Click elsewhere on screen to close the dialogue.
SketchUp optimises structures 'as is' because it's generating (as best it can) contiguous surfaces, structures that are whole and connected - gaps and breaks slow parsing because rendering engines have to stop and start when interpreting what are otherwise consider 'broken' meshes (incomplete surface continuity). This can lead a lot more mesh structure then might otherwise be needed and should be removed
Cleaning up mesh structures can reduce polygon and vertex counts significantly but may not result in meshes that are contiguous - there are Pros and Cons to this but generally it is best to reduce structural complexity where possible to speeds parsing and rendering of meshes
SketchUp models in Blender are typically "Flat" shaded. This is achieved by breaking the Scene into an assortment of independent objects, or down into what are the equivalent of a collection of per-object sub-meshes or elements. Subsequently should the "Smooth" property be assigned, it will by-and-large have no affect because mesh splitting as described above forces the presence of smooth groups irrespective. To overcome this typically means removing duplicate or coincidental vertices with "Remove Doubles", after which smoothing can be better managed assigning the "Edge Split" modifier to the mesh, and marking specific edges as 'sharp', using "Mark Sharp", to create hard edges.
Design note: "Smooth" shading can be assigned in 'Object' or 'Edit' mode. In either instance the option may appear in a slightly different location depending upon the context - in 'Object' mode the option appears under "Shading:" in the "Tools" (Blender 2.70+) tab panel and applies to the 'Object'; in 'Edit' mode under "Shading:" in the "Shading / UV's" tabbed panel and applies to active selections.
To do this, with the object selected, "Tab" into Edit mode and select the entire mesh ("A"), then in the ToolShelf click the "Remove Doubles" button (under the "Remove:" subsection of the "Tools" tabbed panel). To activate "Smooth", in the ToolShelf again, click the "Smooth" button under "Shading:" (see note above). Once done to form the boundary of a 'smoothing group' select the appropriated edges and press "Ctrl+E" to access the "Edges" menu, then click "Mark Sharp" ("Ctrl+E » Mark Sharp"). A colour change should occur indicating successful application. Then finally in "Modifiers" on the right-side of Blender, add an "Edge Split" instance and deactivate "Edge Angle" when the options appear, forcing the modifier to only use marked edges. The mesh will update to display a hard line, or break in surface continuity, where-ever a marked edge is located.
Design note: activating smoothing on a mesh imported from SketchUp will, aside from smoothing the mesh, indicate areas where vertices have not been properly merged together - this tends to happen where vertices are not quite occupying the exact same co-ordinates and/or gaps are present betwixt them. To fix this either manually merge selections using "Alt+M" to "Merge" (or "Mesh » Vertices » Merge"), or by increasing the "Merge Distance" value immediately upon using "Remove Doubles" (ToolShelf bottom - may require exposure clicking the "+" symbol). When assigning "Mark Sharp" selected may or may not change colour depending upon the presence of other edge related properties, UV Seam for example.
Smoothing is controlled through the use of mesh splits which will need to be 'collapsed' using "Remove Doubles" before then using "Mark Sharp" and the "Edge Split" modifier
Imported dae models in Blender often appear untextured and/or white in the 3D View (in "Texture" display mode, "Alt+Z"). This tends to happen because the object has no UV map, no active UV map, or one is available but has not yet received a texture assignment.
Design note: a models appearance varies depending upon the amount of 'data' brought in during import. When viewed in "Texture" display mode for instance, without materials, UV maps or textures, meshes appear grey (the default); without a UV map and texture but with Material, objects take on the colour of the material; without textures but with UV map and material, object appear white.
If the mesh has a pre-existing UV map, to fix the problem simply reassign an available asset to the model using the "UV/Image Editor" (shown below as part of the "UV Editing" layout). If a UV map is not available the mesh will need to be unwrapped (preferably using Seams) before continuing with the assignment process as normal.
Design note: although meshes may appear white, so long as they are textured in SketchUp, and those assets are packaged or available as a result of the export process, they should be data mapped to their respective Materials and ready for assignment in the UV/Image Editor.
Using the "UV/Image Editor" in "UV Editing" layout (selected from "Choose screen Layout" in the upper main header) to reassigned textures to UV Maps - nothing special needs to be done other than assignment, and UV Maps themselves typically don't need to be remapped, it should be a simple case of selecting an object and applying the texture image
Brick texture reapplied to part of the building wall, and a second section in the process with surfaces selected ready for image re-assignment
Where models need to be edited beyond what has been discussed above it's likely they will need to undergo some degree of structural reorganisation - although converting raw triangles to quads helps in this regard, the results are generally not conducive to more complex editing operations; loop cutting around the mesh for example might be limited to the way quads naturally form when converted rather than propagating around the object. The solution is to cut the mesh strategically using standard editing tools, "Knife" ("K"), selection based "Subdivide" etc., and reposition elements so they form a more regulated arrangement that facilitates better editing.
Design note: whilst individual, or groups of, triangulated faces can be extruded without too much issue, using edge or face cutting tools can be much more problematic because division are forced to terminate at a vertex rather than being able to continue across opposing edges, whereas "Knife" will, because it can carve surfaces arbitrarily.
If further work is to be done on the model it will need to be 'prepped' to make this easier. Usually this means converting triangles to Quads and cutting additional loops around the mesh to accommodate better edge-flow whilst working - cuts cannot be across triangle edges unless made using the "Knife" tool. The first image above shows the mesh in its 'raw' form after direct import into Blender, the lower image the structure after update
Although SketchUp's features are limited due to it being freely available for non-commercial use, it is still a relatively powerful 3D application the basics of which can br grasped within a short time-frame. Blender on the other hand is much more complex, but used in conjunction with SketchUp, can prove to be an effective intermediary tool for content preparation rather than production for those not wanting to delve too deeply into using it. Having said that, making content for games typically requires more than a passing understanding of the process to produce properly (read that as 'best') optimised content. In other words, although it is easier to become familiar with SketchUp there is a general need to develop skills mesh editing, UV mapping, materials, and although not mentioned in this tutorial, rigging and animation in a broader context not otherwise provided using SketchUp.
Design note: SketchUp has limited animation capabilities.
In light of this if there is a desire to produce any significant amounts of custom content for games or other interactive media, then SketchUp users may be better off augmenting their knowledge base learning Blender or other 3D application.
The final SketchUp model in Blender fully textured and 'cleaned' ready for additional editing or re-optimisation and export from Blender for use in game
KatsBits provides freely available game and content making tutorials and resources, helping Visitors build their own games, or go further, Game Design Studios!. At KatsBits we strive to bring relavent material to our Readers and forefront Blender as a general game development tool.