I’ve just had an email query as to whether there’s a way of converting .stl files for use in OpenSim:
Do you know of a quick/easy way of converting / importing .stl files into opensim? The reason is that we have a clincian with some medical models of bones etc who wants us to import them into opensim and we cant see to find a way of doing it at the mo.
To be honest, I’d never before heard of the STL file format, so had no idea. I googled it, and found the following in Wikipedia:
STL (Standard Tessellation Language) is a file format native to the stereolithography CAD software created by 3D Systems. This file format is supported by many other software packages; it is widely used for rapid prototyping and computer-aided manufacturing. STL files describe only the surface geometry of a three dimensional object without any representation of color, texture or other common CAD model attributes. … An STL file describes a raw unstructured triangulated surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles using a three-dimensional Cartesian coordinate system.
OK, so far so good. But how about conversion for use in Second Life and OpenSim? Remember we’re looking for “quick/easy”. Back to Google again. And this time I found MeshLab …
… an open source, portable, and extensible system for the processing and editing of unstructured 3D triangular meshes.
The system is aimed to help the processing of the typical not-so-small unstructured models arising in 3D scanning, providing a set of tools for editing, cleaning, healing, inspecting, rendering and converting this kind of meshes.
MeshLab imports PLY, STL, OFF, OBJ, 3DS, COLLADA, PTX, V3D, PTS, APTS, XYZ, GTS, TRI, ASC, X3D, X3DV, VRML, and ALN, and exports as PLY, STL, OFF, OBJ, 3DS, COLLADA, VRML, DXF, GTS, U3D, IDTF, or X3D. Perfect! so with Second Life and second-generation viewers now mesh-enabled I can export .stl to COLLADA, and import into Second Life. But OpenSim?
OpenSimulator supports the use of collada meshes. It must be noted that at the time of this writing, mesh support is still under development at Linden Labs, and they make changes to that all the time. Therefore, we can not guarantee that the current implementation of mesh support in OpenSim will be 100% compatible to the final version on SecondLife, once that gets rolled out. If you plan on using OpenSim to develop meshes for SecondLife, make sure you update Opensim frequently.
Second-generation viewers are reported to deliver rather unpredictable performance (though I confess I’ve not tested them myself in OpenSim). So that’s possibly reason for the time being to also consider the more challenging route, I guess: import the .stl file into Blender (not an application for the faint-hearted), and export as a UV Texture Map (sculpt map) for upload to OpenSim.
OK, so now time to give it a try. I downloaded and installed MeshLab; googled for, found, and downloaded a STL file from PointCloudModeling.com (see references at end of this blog post); opened the STL file with MeshLab; and exported as a Collada file.
Readings and references
The STL Format
Mesh/Creating a mesh
Blender 3D: Noob to Pro/UV Map Basics
Point Cloud Modeling
Mister P.’s MeshLab Tutorials
Uploading a mesh model