Custom Libraries

From OpenSimulator

Revision as of 22:03, 13 July 2011 by Rknop (Talk | contribs)

Jump to: navigation, search


Adding new content(scripts,textures,notecards,objects,etc.) to your OpenSim server isn't that hard to do. The two ways to do it are:

  • Using the viewer
  • Preparing your content, and directly importing it to the server (preferred for large amounts of content)

The second method can be divided into two parts:


Preparing Library

If you want ready-to-import libraries, you could check out the Free Assets section...

Textures

Converting Textures

The jp2 files used by the Secondlife client, are actually j2k files. These can be encoded by image_to_j2k from openjpeg. There is a Linux script or Windows script in perl, that does all the work for you. It uses imageMagick and image_to_j2k to make valid input files and converts them to j2k fileformat. It then renames the j2k file to jp2 extension, so these can be used within the viewer.

  • Download the blender texture cd (as an example)
  • Prepare your imagefiles (jp2 files with 16,32,64,128,256,512,1024 resolution and aspect ratios 1:1,1:2,1:4,1:8,1:16,1:32,etc. are supported)
  • Copy the jp2 files(including directory-structures) into the /opt/opensim/library directory

WARNING: this script merrily deletes the original image, without checking to make sure everything worked. If something goes wrong and the jp2 image isn't created, your image may be gone. Make backup copies of the images before you try to run the script on the conversion!

Version 1.3 of the OpenJPEG libraries does not support greyscale images. If you have a greyscale image, that will trigger the condition above where your image gets deleted. Version 1.3 of the OpenJPEG libraries also does not support transparency.

As of revision 824 of the OpenJPEG SVN library, image_to_j2k is able to write out jp2 files directly. (The script assumes that only j2k files may be written, and does a rename. It also supports transparency, and may read PNG files directly, and (at least with PNG files) handles greyscale images. It's worth compiling one of those versions. "Somebody should" update the conversion script to be safer. (Yeah, yeah, I know.)

Terrains

Create a terrain heightmap


Importing Library

Creating a custom library

  • Create the appropriate xml storage files using the Asset Generator script
  • Edit the opensim inventory library reference file
nano /opt/opensim/production/bin/inventory/Libraries.xml
  • Add the inventory reference
<Section Name="OpenSim Custom Library">
 <Key Name="foldersFile" Value="MyCoolOpenSimLibrary/3DDCInventoryFolders.xml"/>
 <Key Name="itemsFile" Value="MyCoolOpenSimLibrary/3DDCInventoryItems.xml"/>
</Section> 
  • Edit the opensim assets library reference file
nano /opt/opensim/production/bin/assets/AssetSets.xml
  • Add the asset reference
<Section Name="OpenSim Custom Asset Set">
 <Key Name="file" Value="MyCoolOpenSimAssetSet/3DDCAssetSet.xml"/>
</Section>
  • Restart OpenSim
  • Check out if the textures are rendered correctly in the viewer

Load Terrain

Assume your file is called "terrain.r32".At the region console, type:

script terrain load terrain.r32

You now have your new terrain! You can at this point use the terrain add, terrain scale, or terrain multiply to rescale it to your liking.

Personal tools
General
About This Wiki