OpenSim OAR Convert to Unity Scene

A later version of OAR Converter is available which includes a Windows graphical user interface for convenient conversions. See this blog post.

This page gives notes and links related to the OAR converter to create textures, meshes and terrain suitable to import into a Unity scene. The converter has been created by Fumikazu Iseki at the Network Systems Laboratory of TUIS (@Fumi.Hax – @fumi_hax) in Japan.

2015-09-04-Unity-OpenSim-OpenVCE-960x598arrow-right-36x1872015-09-04-Unity-OpenVCE-Web-Payer-960x598

2015-09-04-OpenSim-Black-Rockarrow-right-36x1872015-09-04-Unity-Black-Rock

2015-09-04-OpenSim-Space-960x598arrow-right-36x1872015-09-04-Unity-Space-City-Web-Player-960x598

2015-09-04-OpenSim-Marineville-960x598arrow-right-36x1872015-09-04-Unity-Marineville-Web-Player-960x598

2015-09-04-OpenSim-Oil-Rig-750x468arrow-right-36x1872015-09-04-Unity-Oil-Rig-Web-Player-960x598

2015-10-26-OSGrid-Castle-300x187arrow-right-36x1872015-10-26-Unity-Castle-300x187

Sample OAR Conversions are available at http://www.aiai.ed.ac.uk/~ai/unity/#oarconv

OpenSim OAR Conversion to Unity Project

If you have root access on a Unix/Linux system, obtain OARConv in source form to compile. The setup requires the zlib compression utility and OpenJPEG (1.2 and 2.1) libraries to be installed into system directories. Full instructions to follow carefully and download links to all required components and libraries are at:

http://www.nsl.tuis.ac.jp/xoops/modules/xpwiki/?OAR%20Converter

If you are a normal user without sys admin/root access, a binary precompiled version of OAR Conv is available (use latest version). Extract this zip file in your HOME directory (as the oarconv.sh script provided assumes this location unless you modify it).

Extract OARConv binary
$ cd
$ wget http://www.nsl.tuis.ac.jp/DownLoad/SoftWare/Linux/oarconv_bin-1.4.0.zip
$ unzip oarconv_bin-1.4.0.zip

You can then perform the conversion as follows (for the binary version)…

1. Extract OAR File
$ mkdir OAR
$ cd OAR
$ tar zxfv oar-filename
$ cd ..

2. Execute oarconv
$ ./oarconv/oarconv.sh -i OAR

The resulting translated assets for the OpenSim OAR are placed in ./DAE

The rest of the process to convert the translated assets into a Unity project are very well described in this YouTube video… https://www.youtube.com/watch?v=LUhqNJHLCuM.

Take care to include the customised Editor/SelectOARShader.cs in the project assets. Including this in a Unity3D project compiles it and makes it available without any further action. An introductory tutorial on Unity Shaders is available here.

You will see a warning from Unity about a mesh having more then 64K vertices or triangles indicated on loading the assets in Unity. The converted OpenSim terrain mesh has 256x256x2 triangles, but Unity itself splits larger meshes into smaller components to address this.

oarconv Shell Command Parameters and Flags


oarconv [-i OAR directory] [-o output directory] [-a adding assets directories that separated by ':'] [-f object xml file]
        [-t terrain texture scale] [-c external convert command of jp2]
        [-s start no.] [-e end no.]
        [-x shift of x direction] [-y shift of y direction] [-z shift of z direction]
        [-b] [-p] [-d] [-v] [-h]

  -i : specify OAR directory. default is ./
  -o : specify output directory. default is ./DAE/
  -f : specify object xml file. only specified file is converted.
  -a : specify adding assets directories that separated by ':'. default is /usr/local/share/oarconv/assets/:./assets/
  -t : specify terrain texture scale. default is 7.000000
  -c : specify external convert command from jp2 to other image. default is "/usr/local/bin/opj_decompress -i %s -o %s >/dev/null 2>&1"
  -s : specify start number of xml file. default is 0.
  -e : specify end number of xml file. default is -1 (minus number means infinity).
  -x : specify shift of x direction of all objects. default is 0.0
  -y : specify shift of y direction of all objects. default is 0.0
  -z : specify shift of z direction of all objects. default is 0.0
  -b : output STL file(s) using BREP.
  -p : when linked objects include phantom even one, saved to Phantom directory.
  -d : debug mode. display debug information. 
  -v : display version information. 
  -h : display this help messages. 

   ex.) oarconv -i OAR -a /usr/local/opensim/bin/assets/TexturesAssetSet:./assets -d

X, Y, Z offset function to oarconv (v1.3.4 onwards)

You can convert multiple adjacent OpenSim regions using the x (East/West on map) and y (North/South on map) offsets, usually with +/-256 for normal 256mx256m regions.

E.g. if region positions are [A][B] ...
    oarconv -i OAR_A  -o DAE_A 
    oarconv -i OAR_B  -o DAE_B  -x 256 
Drag & Drop DAE_A and DAE_B to project view of Unity3D

Project Base for OAR Converter Projects

Once you have successfully tried a conversion and understand the elements, you may wish to create a base for any future OAR conversions… which can include all the steps except for the drag and drop in of the actual DAE converted content. Do this yourself to incorporate the very latest OAR Converter content, scripts and Unity assets.

But, for convenience, a Unity 5 base “unitypackage” has been created which includes the required Editor/SelectOARShader.cs, the water layers and the Unity 5 Standard Assets “Ethan” character with simple movement and attached camera. An alternative with the Blender open source Sintel movie character and attached camera setup as indicated in the OARConv YouTube video is also provided at…

http://www.aiai.ed.ac.uk/~ai/unity/oarconv/

Make a copy of the base project you created or a new unity project, import the chosen unitypackage as a base, and then drag the OAR Converter produced “DAE” directory into the Unity Project Assets area, add the DAE folder assets and those in the DAE/Phantoms folder to the hierarchical view panel. Adjust the position of the chosen character and attached camera to suit the region, save the project, save the scene, and you should be good to go.

OpenVCE OAR Conversion

2015-09-05-OpenSim-OAR-in-Unity-VR-2
2015-09-05-OpenSim-OAR-in-Unity-VR

Black Rock OAR Conversion

OARConv-Black-Rock-1
OARConv-Black-Rock-2 OARConv-Black-Rock-3-Water-Added
OARConv-Black-Rock-4-Unity-Chan-Added OARConv-Black-Rock-5-Finished-Scene
OARConv-Black-Rock-6-Web-Player-1 OARConv-Black-Rock-6-Web-Player-2

During conversion the OAR Converter reported three missing texture assets… which was exactly the same as the original OpenSim “save oar” command reported.

Space City OAR Conversion

2015-09-04-Unity-Editor-Space-City

2015-09-04-Unity-Space-City-Web-Player

Using the oarconv -x offset capability, I added the adjacent “Outer Space” extension OAR (to the West/Left) by doing the OAR conversion with the -x -256 parameter.

2015-09-07-Unity-Editor-Space-City-plus-Outer-Space

Added Note: I find that a better way to join and appropriately offset multiple OpenSim region OAR Conversions into Unity3D is to simply save each region normally without any x/y offset and then to mount each into its own empty game object placed at 0,0. Then change the root gameobject for the region to the appropriate multiple of 256,256 required to place it relative to other regions.

Marineville OAR Conversion

Marineville is an OpenSim region where parts of the build go below the usual Z = 0m.. in fact down to -20m. Conversion for negative vertical objects seems to work fine in OAR Conv.

2015-09-04-Unity-Editor-Marineville
2015-09-04-Unity-Marineville-Web-Player
2015-09-04-Unity-Marineville-Web-Player-2

Since this is a region with a lot of ocean, a larger sea/water surface disk was used and an underlying sandy bottom added under the region’s own 256×256 terrain, using the sandy bottom terrain in the Oil Rig conversion exported from that as a unitypackage and imported to the Marineville Unity build – see below.

2015-09-07-Unity-Editor-Marineville

Oil Rig OAR Conversion

2015-09-07-Unity-Editor-Oil-Rig
2015-09-04-Unity-Oil-Rig-Web-Player

During conversion the OAR Converter reported a number of errors related to texture conversion. The OAR Converter tries a number of JPEG2K libraries to do its best for conversion, but some still cannot be converted.

OARTool::ConvertTexture: ERROR: texture 2c73e9a4-ef4d-4181-8984-d7604ed6fa81 convert error (-9, 1)

There were so many mesh parts in the RGU Oil Rig model that it was not possible in Unity ( version 5.1.3f1) to select them all and drop them into the hierarchy view. They had to be selected in sub-sets and with care all were added successfully. Take care you do not miss any assets if you have to do this for your own conversion.

The ocean sandy bottom terrain in the Oil Rig model was exported as “unitypackage” (right click on the asset and select “Export Package”) so it could be imported to other OAR conversion to act as an underlying terrain, scaled 5 X 5 X 1 and with the vertical position set just under the OARs own terrain.

OpenVCE OAR Conversion

2015-09-04-Unity-OpenVCE-Web-Player

TUIS – Unity Demos of Converted Scenes

http://moon-light.nsl.tuis.ac.jp/unity/G​ardenOasis/GardenOasis.html
http://moon-light.nsl.tuis.ac.jp/unity/B02/B02.html


Characters

unity-chan-license-logoUnityChan-DemoUnity-Chan – The Unity-Chan anime style character provided for non-commercial use that can be inserted into the converted Unity scene to give you an avatar to move through the scene. It is included in the Unity3D folder that is in the OARConv distribution. Check the Unity-Chan licence terms and further downloads.

Other Open Source Avatar Assets are available for Unity and are described in this post.


Particle Systems and Effects

The OAR Conversion process does not bring across any active scripting, particle systems (for smoke, fire, etc) or special light sources. You need to add these again into a Unity project.


Tipodean OpenSim OAR Conversion to Unity Assets

I have previously written notes on using the Tipodean OAR Converter. As at September 2015 http://tipodean.com no longer seems to be available, but the converter web site and previous examples, including multi-user OpenVCE region demonstrations, with and without VOIP, continue to run at http://converter.tipodean.com/unity3d/index.html.

http://blog.inf.ed.ac.uk/atate/2011/11/30/openvce-virtual-worlds-assets-moved-from-opensim-to-unity3d-via-tipodean-collada-converter/
http://blog.inf.ed.ac.uk/atate/2011/11/30/openvce-virtual-worlds-assets-moved-from-opensim-to-unity3d-via-tipodean-collada-converter-2/

2015-09-09-Tipodean-OAR-Conversions
2015-09-09-Tipodean-OpenVCE


OpenSim-related Tools from the Network Systems Laboratory of TUIS, Japan

Fumizaku Iseki and others at the Network Systems Laboratory of TUIS in Japan have experimented with a number of other very interesting OpenSim and Virtual Worlds related tools. See http://www.nsl.tuis.ac.jp/xoops/

OpenSim Diaroma System – Using 3D Terrain in OpenSim

This System uses SRTM (Shuttle Radar Topography Mission) 1/3 data and Google map data. Open Source.

http://www.nsl.tuis.ac.jp/xoops/modules/xpwiki/?OpenSim%2FDiorama2
https://www.youtube.com/watch?v=RLtI-2uCRVY

Motion Capture to Second Life and OpenSim Avatar Movemement by Jessica Pixel

Using the “Rinions” package from the Network Systems Laboratory of TUIS, it is possible to use a Microsoft Kinekt for Windows to do motion capture and relay it live onto a SecondLife/OpenSim avatar.

http://liftedpixel.net/blog/posts/kinect-rinions-and-second-life
http://nwn.blogs.com/nwn/2015/08/second-life-kinect-motion-capture.html
http://nwn.blogs.com/nwn/2015/08/second-life-live-streaming.html


Output of STL Files for 3D Printing

OARConv version 1.4.0 (22nd September 2015) introduced an additional capability using a “-b” flag to output STL format files which are suitable to use on 3D printers. An example of usage to convert one item (.xml) in the unzipped untared OAR is:

% oarconv -i ABYSS -o STL -f ABYSS/objects/Venus_428-154-3720__e633f42c-abb2-498b-aadb-ea6781506f98.xml -b

See the following instructional video. A simple STL viewer for Windows is also available.

2015-09-22-STL-Viewer-Supercar

This entry was posted in OpenSim, Virtual World and tagged , , , , . Bookmark the permalink.

2 Responses to OpenSim OAR Convert to Unity Scene

  1. Graham Mills says:

    Is Tipodean’s service still functional? 404 for me.

  2. bat says:

    As at September 2015 http://tipodean.com no longer seems to be available, but the converter web site and previous examples, including multi-user OpenVCE region demonstrations, with and without VOIP, continue to run at http://converter.tipodean.com/unity3d/index.html.

Comments are closed.