realXtend documentation
for release 0.3.


Version history (if you edit this document, please include change summary here)

August 19th, 2008/Heikki Törmälä
        Added instructions for two sided particles.

July 2nd, 2008/Lasse Öörni
        Added section on avatar exporting.

June 30th, 2008/Lasse Öörni
        Updated compiling instructions.

June 27th, 2008/Tony Manninen
Added Avatar Generator intructions and FaceGen Modeller / FaceGen2reX guidelines
Added Rex Tailor instructions
Beginning of the document edited


April 14th, 2008/Antti Ilomäki
1.3/3: Changed the recommended procedure to obtain the external IP address

April 11th, 2008/Lasse Öörni
Updated release number.
Updated client compile instructions.

March 14th, 2008/Jani Pirkola
Version history started to keep track what is being changed
Corrected chapter 1.1 how to setup a server
Corrected chapter 1.3 how to setup server so that other people can connect to it
Added title to the document


Foreword

Please keep in mind that both this text and the realXtend platform are in early stages of development. Some features may still be buggy and the text in this document may become outdated. If you notice errors in either the software or this document, please let us know and we will try to fix the issue. For more information and bug reports you can contact us at info@realXtend.org. We sincerely hope that our hard work will come to benefit as many people as possible. Enjoy.


1. Rex Overview

The aim of the realXtend project is to develop a massive, multiuser, high-performance, hybrid virtual reality framework and the necessary content creation tools. The results of realXtend project are released as open source to enable global contribution. realXtend can and will be used as a base for creating impressive, entertaining, educational, and functionally diverse virtual environments.

One of the core components of the realXtend framework is the server, which is based on the open source OpenSim server software. The OpenSim platform was chosen early on in the project as the most suitable starting point because of its technical properties, open source licensing and the future potential that was evident from the quick pace of its development already back then.

The realXtend viewer is a heavily modified version of the Linden Labs' Second Life client. Second Life has an impressive set of building and communications features, which make the client a good starting point for experimental development. The realXtend viewer is meant to showcase the important new features such as complex 3d meshes and document sharing that the realXtend / OpenSim server already support. The choice of platforms was quite logical, because OpenSim based systems are compatible with the Second Life client.


1.1. How to setup a server

realXtend server setup has two main configurations: 1) standalone version running on your personal computer without any outside access, and, 2) networked version that can accept logins from other people/computers. The standalone configuration is mainly for testing and learning purposes, so that's where you should start if not yet familiar with the realXtend system.

In order to setup a standalone server:

1) Download and unpack the server to the folder of your choice
2) Run StartStandaloneRexServer.bat (available in the main folder)

Notice! If you are running the server in Windows Vista, run StartStandaloneRexServer.bat in Administrator-mode.

The server has been preconfigured to run in the rex_authentication mode, so the StartStandaloneRexServer.bat starts actually 3 servers:

  1. Authentication Server (for user ID handling)
  2. Avatar Storage Server (repository for the avatars)
  3. RexServer (the actual world server/sim)

The servers have been preconfigured to run just on your local machine (127.0.0.1). To enable connections from other computers than localhost, see chapter 1.3.


1.2. How to use the server and change settings

The Server's various settings can be configured in the following files:

  • ..\rexserver\OpenSim.ini
  • ..\rexserver\Regions\*.xml
  • ..\rexserver\estate_settings.xml
  • ..\rexserver\mysql_connection.ini
  • ..\rexserver\mssql_connection.ini

Most of the server configuration is handled in OpenSim.ini. You can find further information and explanations about the basic server settings from http://opensimulator.org/wiki/OpenSim.ini.

Some of the settings are rexserver specific and explained below with their default & suggested values:

[Startup]
worldlibraryfolder = True
- Enables the common folder under Opensim folder which every avatar has. The folder contains all the 3D models and textures loaded into the asset database. Since the object rights don't work fully yet, this folder helps to build worlds cooperatively so that everybody can use all uploaded 3D models and assets without having to upload same 3D model many times.

3d_collision_models = True
- Defines whether 3D collision models can be used in the world or not. Only works with physics set to OpenDynamicsEngine.

rex_mode = True
- Enables specific realXtend features and more importantly, tells the rexviewer to use the OGRE rendering when entering the world.

rex_authentication = True
- Is realXtend authentication server used for authentication or not.

rex_python = True
- Is realxtend pythonscript enabled or not.

replace_assets = True
- This means that if an asset of a certain type (for example 3D model) and certain name already exists, and you upload the same type of asset again with the same name, the old asset will be replaced. When replacing a 3D model, it is necessary to exit & restart the realXtend viewer to see it change. Replaced particle effect scripts on the other hand become immediately visible, when you disable & re-enable the particle effect on an object.

[Network]
bandwidth_start = 256000
bandwidth_max = 512000
bandwidth_min = 128000
- Rexserver has it's own throttle system limiting the amount of network traffic for the clients. The bandwidth_max and bandwidth_min values specify the boundaries of throttle per client per second and bandwidth_start specifies the start value. All values are in bytes.

For more information about configuring the server see
http://opensimulator.org/wiki/Configuration


1.3 How to setup server so that other people can connect to it
Follow these steps if you are using rex_authentication (which uses new global avatar system: Authentication Server and Avatar Storage Server):

To enable the server platform for LAN or Internet use so that other people can also access it:
1) Make sure your all servers are down (Authentication Server, Avatar Storage Server and RexServer)

Configuring the authentication:
2) Open ..\authentication\HttpSettings.xml
3) Set the address to your machine's external IP. It should be different than 127.0.0.1. (The easiest way to find out your external IP is to use an online service such as for example http://whatismyip.com/. If you need to know your local network IP do this: Hit Left Windows button+R button simultaneously, type cmd to the opened dialog, press enter, type ipconfig to the command prompt which opened and hit enter). Save and close.
4) Open ..\authentication\AuthenticationSettings.xml
5) Set the default_avatar_storage_url to point to the external IP address of the avatar server machine. Set default_grid_url to point to the external IP address of the rexserver machine. Leave the port numbers to the end of these addresses. Save and close.

Configuring the avatar storage:
6) Open ..\avatarstorage\HttpSettings.xml
7) Set the address to your machine's external IP. Save and close.

Configuring the rexserver:
8) Open ..\rexserver\regions\default.xml file
9) Change the external_host_name parameter to your machine's external IP address. Save and close.
10) Open ..\rexserver\truststore.xml file
11) Add a new AuthenticationNode line by copy-pasting the <AuthenticationNode>127.0.0.1:10001</AuthenticationNode> just below the original line. Modify the IP address on that line to  point to the external IP address of the authentication server machine. Save and close.

Now start all the servers by activating StartStandaloneRexServer.bat


Follow these steps if you are NOT using rex_authentication:
To enable the server for LAN or Internet use so that other people can also access it:
1) Make sure your server is not running.
2) Open your ..\rexserver\regions\default.xml file
3) Change the external_host_name parameter to your machine's external IP address. It should be different than 127.0.0.1. (The easiest way to find out your external IP is to use an online service such as for example http://whatismyip.com/. If you need to know your local network IP do this: Hit Left Windows button+R button simultaneously, type cmd to the opened dialog, press enter, type ipconfig to the command prompt which opened and hit enter). Save and close.
4) Start server.


See also Chapter 4 of this document for further instructions.


2. Avatar System Introduction
 

In realXtend architecture the avatar storage is a separate entity that is mainly used to store the avatar and its assets in a specific place so that it isn't directly dependent on any single world server. The world server and clients connected to it will fetch the necessary data directly from the avatar storage, reducing the world server's load and making seamless transitions between different worlds as simple as browsing the Internet. The avatar service providers are in a central position, offering the users bandwith and secure identity for virtual worlds browsing.

 

 

2.1. How the reX avatar system works  

 

The realXtend avatar system consists of several tools and applications, which are briefly described in the following chapters.

 

2.1.1. Purpose of reX avatar system 

 

The purpose of reX avatar system is to provide a global avatar standard where users can use avatar that they’ve created all around with different virtual worlds, without the need to recreate their avatar everytime they log into a new world.

 

2.1.2. Main scheme 

 

reX avatar system consists of components listed below:

 

-          Viewer clients (realXtend viewer)

-          Avatar generator 

Used for creating and editing avatars

-          Authentication Server 

Keeps records of users and authenticates them when they log in.

-          Avatar Storage  

Stores and delivers avatar data when needed

-          realXtend server  

OpenSim world server running in "rex" mode

 

Viewer clients and avatar generators authenticate themselves by logging in to an authentication server using accounts created to the authentication server.  Avatar generators need authentication when sending data to Avatar storage and viewer clients when logging to a realXtend server. As response they get a session key they use to verify who they are in the 2nd phase authentication. In the 2nd phase, Avatar Storage or realXtend server asks from the authentication server if the session key they’ve received is valid or not.  

 

Login process for viewer client described in 5 phases:

 

1.      Clients authenticates itself to the authentication server & gets a session key.

2.      Client logs into a realXtend server and sends its session key with a login message

3.      RealXtend server verifies the users identity from the authentication server with the session key. Avatar storage address is returned from the authentication server. When the realXtend server verifies the client it uses a list of trusted authentication servers.

4.      The realXtend server sends avatar storage addresses of all avatars that are logged in to server.

5.      The client fetches avatars from their respective avatar storages.


 

2.2 How to use the Avatar Generator 

Avatar generator can be started from "View" menu -> Avatar Generator, after you have rexviewer running.

The Avatar Generator is a tool which you can use to select, modify, clothe and save your avatar. The tool includes some ready made clothes and accessories that provide an example of the range of material there can be in realXtend avatars. This chapter outlines the main features of the Avatar Generator and the Facegen2rex tool.


2.2.1 Basic use

Controls
  • Click and drag left mouse button to rotate the avatar or zoom in.
  • Click and drag right mouse button to turn avatar around.
  • Pause/Resume animation can be used at any time while creating and editing your avatar, provided that the selected avatar 3D model contains a properly named walking animation.
  • Click reset to start over.
  • Undo works for bone deformations only.

Changing basic appearance
  • Use the arrows next to the 'Model' box to change to a different 3D model of the avatar.
  • Use one of the menu options (Outfit, Skin, Animations, Appearance, Advanced) to select your edit mode.
    • Outfit is for 3D-clothes that are specifically placed over the avatars body
    • Skin is texture-based clothing, which are painted images drawn on the avatar skin
    • Animations and their speed can be selected from the list (if the avatar model has some options)
    • Appearance is for basic avatar mass, muscle and posture modifications that can be used to change the body shape
    • Advanced is for more detailed re-shaping either using morphing, or, editing the bone sizes. See the section Advanced menu for further instructions.

Outfit menu
  • Some of the realXtend avatars are equipped with a 3D clothing and hair collection
  • Select the part of the avatar you want to modify (Head: Hat, Hair, Accessories, or, Body: Top, Bottom, Accessories).
  • Use the arrows to cycle through the available options. If nothing is visible, the avatar base model may not have any ready made outfits.
  • In RealXtend hair and other avatar accessories are attachments. It means that these may be separate from the avatar's 3D model.
  • Notice: In realXtend Avatar Generator version 0.3, some of the clothes show the underlying avatar skin in certain places. These errors, however, do not occur inside the realXtend virtual worlds.

Skin menu
  • Use the arrows next to the 'Face skin' and 'Body skin' to change the avatar's skin and clothes.
  • Texture-based clothes are shared between all avatar base models, but they may not be aesthetically compatible between each other. For example, male clothes won't look right on female avatars and vice versa. Use discretion when selecting clothes, but feel free to experiment.

Animations menu
  • Select the appropriate basic animation for your avatar from the drop-down list under the "Walk animation:" heading.
  • Modify the movement speed using the slider.

Appearance menu
  • In "Body" tab: use the sliders to change the body mass, muscle mass and height of your avatar.
  • In "Posture" tab: use the sliders to change the curvature of your arms and legs, and to twist your spine backwards/forwards.

Advanced menu
Bones scale:
  • Select the appropriate bone from the list.
  • Select the axis (x,y,z) you want to use for modifications.
  • Select the modification you want to do (rotate, scale, or translate).
  • Use the slider to increase/decrease the amount of modification.

Morph modifiers:
  • Select the morph target you want to modify from the drop-down list.
  • Use the slider to apply changes.

Attachments (Attach and Remove):

Exporting avatar
  1. Click the 'Export...' button to upload your avatar to an avatar storage server, or to save a local copy.
  2. Type in your account and password to the export dialog and click Export. After the avatar is successfully exported, you can close the dialog. If you encounter an error, check the account text, server address and password, and try again.

Importing avatar
Only locally saved avatars can be imported. Whenever you export an avatar, a local copy is also created. If you create your avatar on one computer, it is not possible to import it on another computer.
  1. Click the 'Import...' button to import locally saved avatar.
  2. Type in your account and click Import.

2.2.2 Advanced use

Custom 3D models for avatars
Avatar generator supports Ogre meshes. Place the Ogre mesh and optional skeleton to Data/Media/Models/Avatar subfolder inside the Avatar Generator folder. The model should now be available in the Avatar Generator. Place the model specific textures to Data/Media/Materials/Textures subfolder and Ogre material scripts to Data/Media/Materials/Scripts subfolder.

For animations to work properly, they need to follow the naming convention of the basic female/male avatar animations.

Custom clothes (skins) for avatars
Place face textures to Data/Media/Materials/Textures/avatar_face subfolder and body textures to Data/Media/Materials/Textures/avatar_body subfolder inside the Avatar Generator folder. The textures should now be available in Avatar Generator. Supported image formats are the same as Ogre's supported image formats.

Creating/editing attachments
Usable attachments are defined in Attachments.xml file found in Data/XMLData subfolder under the Avatar Generator folder. Attachment tool is provided to streamline the creation/editing of attachments.

Bone deformations
Select a bone from the bones drop down box. Select the method you want to apply to the bone: rotate, scale or translate. Select any combination of the axis you want to use for the method: x, y or z. Use the slider under the bone drop down box to deform the bone. You can undo deform changes with the undo button.

2.2.3 Attachment tool

Controls

Controls are roughly the same as in the Avatar Generator. You can click and drag an attachment with the right mouse button. Click on 'Save attachments' when you want to export the attachments to the Avatar Generator. Note that this will save all the attachments and all the changes you have done to them.


Creating new attachments
  1. Ogre meshes are supported as attachments. Place the Ogre mesh to Data/Media/Models subfolder in the Avatar Generator folder, the textures to Data/Media/Materials/Textures subfolder and material scripts to Data/Media/Materials/Scripts subfolder in the Avatar Generator folder.
  2. Click on 'New attachment...' and select the Ogre mesh that you want to use as an attachment. The mesh should appear on the screen, near the feet of the avatar.
  3. The attachment is automatically added to the attachments drop down box and selected.
  4. Select a bone from the bones drop down box, the mesh is attached to that bone.
  5. Click and drag the attachment mesh with right mouse button to move it to it's proper place.
  6. If you want the attachment also on another bone, just repeat steps 4-5.
  7. If you want the attachment on two or more different positions on the same bone, you need to create new attachment for each different position.
  8. After you are done, click on 'Save attachments'. The attachment should now be available in the Avatar Generator.

Editing existing attachment
  1. Select the attachment from the drop down box.
  2. Select the bone to attach to.
  3. Place or replace the attachment.
  4. After you are done, click on 'Save attachments'. The changes should now be available in avatar generator.

2.2.3 Your own face into realXtend

You can have your own face in realXtend if you use the FaceGen Modeller (it's free) from Singular Inversions and our FaceGen2rex tool. The procedure is pretty straightforward, so you do not need to be a professional 3D designer to complete the following steps:


Use FaceGen Modeller to construct your own face model

  1. Download and instal the FaceGen Modeller
  1. Start the modeller and select the PhotoFit tab.
  2. Take 1-3 photographs as described in the FaceGen Modeller PhotoFit instructions.
  3. Upload the photograph files to your computer.
  4. Click Next when happy with picture files.
  5. Move the green crosses to the corresponding places (as shown on the reference image) and click Next when done.
  6. Repeat the previous step again as many times as the tool asks you to.
  7. When complete, press Start Now button and wait until the face has been processed.


Use FaceGen2reX tool to convert your face model into realXtend format
  1. Start the program "facegen2rex.exe" with no command line arguments and follow these steps - you will be presented with 5 file selection dialogs.
  2. Choose the base model (.tri file) from the FaceGen2Rex's Data subdirectory - either the male (Jack) or the female.
  3. Choose the base texture image for the face. Ready-made base textures exist in the Data subdirectory. The image can be either .jpg or .bmp format, but its resolution must match what the FaceGen files expect (512x512).
  4. Browse for your face coordinate data (.fg) file that you want to be applied on the model.
  5. Enter the name & location of the output realXtend mesh file to be saved. realXtend expects the file to be saved in a certain subdirectory - media\models\avatar - under the realXtend installation directory (for example C:\Program Files\realXtend\media\models\avatar)
  6. Finally, enter name & location for the modified texture image (.jpg format). This should be media\materials\textures\avatar_face under the realXtend installation directory. (for example C:\Program Files\realXtend\media\materials\textures\avatar_face)

See FaceGen2reX Readme for more information and the instructions to use the command line mode.


Finalization - copying avatar specific settings
Lastly, make a copy of the avatar description .xml file in realXtend's media\models\avatar directory to match your new avatar. For example, if you used the male (Jack) as your base model, and saved your avatar mesh as JackMyFace.mesh, make a copy of Jack.xml and rename it JackMyFace.xml. This ensures that animations and body shape controls will also work as expected for your customized avatar.

Now you should be able to choose your new custom avatar in the realXtend avatar generator and select the custom face texture. Follow the Avatar Generator modification instructions to change your avatar.


2.3. How to use Rex Tailor for advanced cloth modifications

Controls

 
Right mouse button = rotate view
Left mouse button = select vertices
Middle mouse button = pan view
Ctr, shift or Alt + Right mouse button = pan view
Mouse wheel = zoom in / out
Shift + Left mouse button = add to selection
Ctrl + Right mouse button = remove from selection



Removing avatar clipping issues from attachments

 
- Open the avatar mesh that the attachment is meant for.
- Attachments should be per avatar (similar avatars also work)

- Open attachment tools.
- Load the attachment. All attachments are in the media/models/attachments folder.

- You should see the avatar mesh on the screen. It might not be on the center of the screen. Hold middle mouse button to pan view around.
- The attachment should be shown as wireframe on top of the avatar mesh, attached to the first bone specified in the attachment file.

- From the avatar mesh, select all vertices that are covered by the attachment mesh and delete them.
- If you accidentally deleted wrong vertices, just select the vertex and undelete.

- Check the attachment periodically in the Viewer to see if there is any visible clipping left or if you accidentally deleted wrong vertices.

- When you are done, save the attachment either as completely new attachment, or on top of the old one.



Creating flowing clothes (for improved physics modelling)


- Load new cloth mesh. The mesh should be upright and properly sized.
- Select the vertices you want to have physically simulated and moving.
- Set Physics Enabled on those vertices.
- Select the vertices adjacent to the previously selected vertices, but which should not be moving.
- Enable physics and set Fixed on those vertices.

Testing:
- Click on 'Edit Mode' to switch modes.
- Click on the 'Force Ball' on the lower center of the screen to apply force to the cloth.

Gravity:
- Gravity is enabled to all vertices by default, but it's advisable to set gravity to 0 0 0.
- Set value other than zero to Static Rigidness if gravity is disabled.

Static Rigidness:
- Affects how well the cloth stays in it's original form (in the mesh shape).
- Values 1.0 - 6.0 are suitable.

To create light fabrics:
- Select all vertices
- Set rigidness multiplier value to 1.0-4.0, lower value for lighter fabrics
- You may need adjust Force Multiplier if the cloth goes out of shape when force is applied. Set lower values on vertices that are greatly affected by the force (tight contentrations of vertices). Set higher values on vertices not greatly affected by force (sparce areas).

To create heavy fabrics:
- Select all vertices
- Set rigidness multiplier value to 4.0-7.0 or higher, high values for heavier fabrics
- You may need adjust Force Multiplier if the cloth goes out of shape when force is applied. Set lower values on vertices that are greatly affected by the force (tight contentrations of vertices). Set higher values on vertices not greatly affected by force (sparce areas).

To add wind turbulence:
- Wind turbulence makes the cloth appear more live.
- Select all vertices.
- Check 'Fake wind flutter'.
- Adjust wind options based on how heavy the fabric is.
- Increase 'Wind force multiplier' to have the wind have greater effect when the cloth moves.
- Increase 'Wind amplitude' to increase wind stength.


If the cloth doesn't stay in shape:
- Add Physics iterations to 3-6. High values will greatly increase processor load so be careful.
- Adjust 'Force Multiplier' on small groups of vertices that get out of shape.

- After done, save cloth to the same folder as the mesh.
- Create new attachment with the attachment tool by loading the cloth file.


 

2.4. How to setup user authentication 

 

Configuration options are asked on the first run, defaults should be fine,

First configuration option asked is database_dll  (default value MS_SqlHandler.dll) ,

if you dont have MS SQL server installed, tell authentication

to use "SQLite_SqlHandler.dll" or “MonoSQLite_SqlHandler.dll” for database handler.

 

Authentication engine option is always set to it’s default value  AuthenticationEngine.dll option.

logging_enabled option specifies if logging is enabled. If set to true server writes log data from requests it gets.

Next thig asked is database specific data, user name, password and with sqlite the name of the database where the data is stored.

For ip address enter the ip address of your computer or if you running authentication server locally then you can use default value 127.0.0.1.

After setting the port you are done and authentication server is up and running. Settings can be edited afterwards in xml settings files stored to execution folder:

AuthenticationSettings.xml, HttpSettings.xml

database settings: mssqlSettings.xml, mysqlSettings.xml, monosqliteSettings.xml

 

After you have setup authentication server you must add the authentication address of your authentication server to authentication list,

where all acceptable authentication addresses are listed. You can either edit the truststore.xml on simulators running directory or use

authentication command on simulator commandline prompt (works only with standalone mode and rex_authentication mode on in rex server

and on user server when running in rex_authentication mode).

 

 

2.5. How to use user authentication  

 

Run Authentication.exe either from command line or by clicking the .exe file.

Entering “help” to command line gives list of available commands:

-          create user - Create a new user.

-          shutdown - Quit.

When creating a new user just enter data asked at the command prompt. When you create a user you should know the avatar storage address and the default grid url where the user will be logging in by default. Avatar storage address and grid url are entered with ”http://” prefix at the beginning.

 

2.6. How to setup the avatar storage  

 

Setting up the avatar storage has pretty much same phases as setting up an authetication server. Even the database handler names are the same so you can choose again “SQLite_SqlHandler.dll” or “MonoSQLite_SqlHandler.dll” when you want to use sqlite as the database.

After running initial configuring settings can again be further edited in the corresponding settings files: AStorageSettings.xml, HttpSettings.xml, mssqlSettings.xml, mysqlSettings.xml, monosqliteSettings.xml, sqliteSettings.xml

 

2.7. How to use avatar storage  

Run AvatarStorage.exe either from command line or by clicking the exe, avatar storage should be up & running. Pressing enter in console closes the application.

 



3 Scripting introduction 

realXtend adds Python script support for the server using Ironpython. The script uses a different kind of system compared to LSL scripts which use the inventory system. This is because the scripts are more powerful and can also access the server machine's other resources. The scripts are stored in the server's ScriptEngines\PythonScript subfolders, not to database. By default this folder contains the RXCore folder which contains the core implementation of the script engine so this folder shouldn't be modified. Samples folder contains some example scripts.


3.1 Short overview of Python and LSL

TODO, text here


3.2 How to put scripts into objects

TODO, text here

 




3.3 How to use Python scripting in reX

The python script engine is object oriented which means that for every prim in your world there is an object in the python script engine. The default object class for a prim is named "rxactor.Actor". If you don't define your own class for a prim, it is then rxactor.Actor. A prim can only have one python script class for it.


At the moment the python class of the prim can be changed on the fly. Internally the script engine deletes the old python object of the prim and creates a new one with the newly defined class.

Automatic script reloading when a script has changed is not supported. However, the python script engine can be restarted on the server by typing command "python restart" to the server console. This command first deletes all python objects, reloads the scripts and then creates the objects again.


Any class you create should be inherited from rxactor.Actor class. The class hierarchy for any custom class is then: object->LSLObject->Actor->CustomClass
object: Built-in python class
rxlslobject.LSLObject : Implements the LSL script interface
rxactor.Actor: Implements additional script functionality


When doing python scripting you actually have the following functionality in your fingertips:

1) The python script implements the LSL script interface which means that most of the LSL functions can be used in the script. All LSL functions are not supported because they haven't been implemented in the server's c# code yet.

2) There are also some additional script functions which have been implemented inside the server and are callable from the python script. Check out the RXCore\rxactor.py and RXCore\rxavatar.py files for details about the additional script functions.

3) You have most of the Python's functionality at your disposal. A note for regular Python users, Ironpython doesn't support all the functionality of the regular Python at the moment. Some of the standard library modules work and some not. For more information about Ironpython go to http://www.codeplex.com/IronPython

4) Ironpython supports c# stuff so you can for example create objects defined in c# dll's, then call their functions and do other kinds of c# stuff in the python scripts.




How to define a python script for a prim

As a very first taste of python scripting lets define a script for a prim and use a ready sample script, set it to a prim and see it working in the world. This tutorial assumes that you know how to do some basic things like creating prims to your world.

1) Start rex server. The server is running when the log writing stops and there is a blue text "Startup complete, serving 1 region(s)". 

2) Start rex client and login to the world

3) Go to build mode and create a normal cube prim to the world

4) Click the reX tab in the build menu's tabs, the prim should be still selected

5) Click the "Extended properties" on which enables the tab page

6) As class name type sampleobject.TestActor and hit enter.

7) If you now momentarily switch from viewer to the server, you'll notice that the log has "TestActor EventCreated" entry in it.

8) Close the build menu and touch the prim by clicking it with your left mouse button. You can't touch objects while building so close the build menu before touching the prim.

9) The prim should change rotation, scale, it should say something to you and the text on top of the prim changes.

10) Congratulations. You have successfully defined a python script for a prim. The script which is executed when the prim is clicked can be found from file ScriptEngines\PythonScript\Samples\sampleobject.py




Changing the python script for a prim

Continuing from the last mini-tutorial, changing what python class a prim uses is very easy.

1) Right click the prim created in the last mini-tutorial and choose edit

2) Go to reX tab page, replace the old Class Name with sampleclientscripting.ClientScripting and press enter

3) Close build menu and touch the object again. The prim uses now the the new class and demos the client scripting capabilities. Touch the object many times to go through all the demos of clientscripting.


Creating your own python script

It's recommended that people who develop python scripts create new folders to the PythonScript folder to hold their own scripts. So your own folder contains all your own scripts or all script of a particular module. This way the name conflicts should be minimum, the scripts are organized in a nice way and you can find your own scripts quickly. So here we go, let's start creating our own scripts.

1) Make sure the server is down and the client is down. This is because the server doesn't load new script folders automatically.
2) Create a new folder named "MyScripts" to ScriptEngines\PythonScript folder
3) Create a new file named FirstScript.py to the MyScripts folder.
4) Open file FirstScript.py and add the following python code to it:
import rxactor
import rxavatar
import sys

class SayHello(rxactor.Actor):
    def GetScriptClassName():
        return "FirstScript.SayHello"

    def EventTouch(self,vAvatar):
        str = self.llGetObjectName() +  " was touched in region "+self.llGetRegionName() + " by " + vAvatar.GetFullName()
        self.llShout(0,str)

5) Create a new file named __init__.py to the MyScripts folder
6) Open __init__.py and add the following code to it:
print "Python:MyScripts init"
import FirstScript

7) Now follow the "How to define a python script for a prim" mini-tutorial on how to define python script for a prim. Basically start the system, create a prim and as it's Class name put "FirstScript.SayHello". Then close the build menu and touch the object. The object should shout you back some text.


Modifying script
Modifying script and reloading it is very easy if you have access to the server's console. As an example, let's change the text that the object says in continuing from the previous mini-tutorial.

1) While server and client are still running, open FirstScript.py and modify the str = ... line to the following:
str = vAvatar.GetFullName() +  ", why did you touch me?"

2) Then to the server's log type "python restart" and press enter which will restart the script engine. The log should read "Python: Started script read" when the script engine has restarted.
3) Back in the client touch the prim again. The prim should shout the new text to you.


Script development workflow
It's recommended that python scripts are developed on a local server. This way the python script engine can be restarted when necessary. When the script is ready, you can just copy the scripts to the public server and start using them after a server reboot.


4.0 Building Introduction

A Primitive or prim is a single basic 3d shape.


How to create a prim

Right click on the terrain and select menu option ”Create”; a window will appear with the create icon selected and you will be able to choose the desired shape, after selecting the shape left click on the ground or any other object to create the prim.


These are the primitive types:

  1. box: all kinds of rectangular shapes

  2. cylinder: round tables, floors, long pipes

  3. prism: a box with one very small face

  4. sphere: can be used for ellipsoids of all shapes

  5. torus: most complex, can be modified in many exotic ways

  6. tube: another form of hollow cylinder

  7. ring: another variant of torus


Prims can be modified in various ways, such as size, twists, shearing, and cutting. Images can be applied to each surface of a prim to change its appearance.


How to link prims

Prims can be linked togheter for creating more complex objects. After linking more prims together, a single center point will be calculated for the new object, the linked prims will behave like one single object and all the editing action will affect the new object created and not the single prims.

To link, while in edit mode ctrl+left click allows you to add prims to the current selection. On the reX menus, in tool, select the ”link” option to join more prims togheter, unlink to separate.


How to modify a prim:

Right click on the prim and select edit; the edit window will appear and you will be able to choose different ways to modify the prim:


- Position: drag the arrows to move the object on the chosen 3d axis

- Stretch: stretch the prim/object, drag the colored cubes around it or scale it using the gray cubes

- Select texture: if selected you can choose only on a single face of a prim for texturing pourposes

- Edit linked parts: if selected you will affect only a single prim of a more complex (and linked) object

- Stretch both sides: if selected resizing is made from the center of the object and affects both sides

- Stretch Textures: if selected the texture applied to the object will stretch as the object is modified keeping a constant repats per face number, if not active the repeat per face value will change

- Use grid: if selected an helping grid will appear while editing an object position, size or rotation

- Option: press to set the grid transparency, the grid measurement base unit and maximum size

- More/Less: press to show and hides the subpanels of the editing window



The reX subpanel

The new feature in the viewer's object edit window is the reX subpanel, which contains various extended features. To enable the extended features on an object, select the reX subpanel, and click the topmost checkbox "Extended properties". Now the rest of the controls on the subpanel become active:

- Description texture: if checked, the description of the object (in the General tab) will be displayed as a texture on its surface. Works only on prims, not 3D models, and best with box-shaped prims.
- Show as mesh: if a mesh asset is selected for this object (see below), the object will be displayed as a 3d model (mesh) instead of a prim shape. If no mesh is selected, checking this will essentially hide the object.
- Scale mesh to prim: if checked, the 3D model is scaled to the bounding box of the underlying prim shape. If unchecked, the original size of the mesh will be used.
- Is visible: when unchecked, allows hiding of an object. Light & particle effects (if any) of the object will remain visible.
- Solid alpha: if checked, object will use alpha rejection mode instead of true alpha blending, if it has textures with alpha channel. The result is less smooth, but is faster and may in some cases prevent rendering artifacts.
- Cast shadows: if checked, the object casts a shadow on the terrain. Note that alpha textures do not cast shadows unless "Solid alpha" is checked.
- Billboard: If checked, object is displayed as a billboard. Billboards are planes that always face the camera. Together with additive blending effect (see fixed material), they can be used for halo/lighting effects. The texture for the billboard is set the same way as for a mesh, by using the material name drop down box.
- Class Name: What python class is used for this prim. Format is FileName.ClassName, for example sampleobject.TestActor
- Draw Distance: maximum draw distance in metres the object will still be visible. 0 means to always draw the object. NOTE: with the "grouping" rendering optimization enabled in app_settings\ogre_scene.xml, this may not work as intended (when objects become grouped)
- LOD Bias: if a 3D model has multiple levels of detail, this controls how the detail levels will be used with distance. Default is 1.0; if set to for example 2.0, the 3D model will retain high detail twice as far as with 1.0.
- Fixed Material: Allows you to apply different material effects to an object, for example additive blending.
- Mesh Name: the Ogre 3D model asset (uploaded .mesh files) to use for this object. There are two ways you can set this:
    1) Inventory drag & drop: drag an uploaded 3D model inventory item into the box (preferred)
    2) Open the combo-box and select from list of available models. Note that before the assets become available for selection, you first need to open those inventory folders containing them, and then refresh the reX subpanel by unselecting and selecting the object to edit, or alternatively, closing & reopening the object editing window.
    NOTE: the same two methods apply also for Collision Mesh, Material & Particle Script controls respectively.
- Collision Mesh Name: the 3D model (mesh) asset to use for server-side per-triangle collision detection. This can be a simplified shape compared to the real geometry of the 3D model.
- Material Name: the textures to use for the 3D model. A 3D model may have multiple submeshes, and therefore multiple textures, the current one to modify is selected with the box next to "Material Name" text. Also "None" can be selected for to display the 3D model untextured.
- Particle Script Name: the Ogre particle script asset (uploaded .particle files) to use for this object. A checkbox next to it allows to easily enable/disable the effect.

Note that the reX subpanel controls only work when a single prim has been selected.

How to use 3d models and the RexMeshTool
1) First you need to have an Ogre format mesh (.mesh file extension) converted from your favourite 3D modeling program. For example, in 3D Studio Max the MaxScript based exporter has been noted to produce adequate results.
2) Next, we need to ensure that the model is in a good scale & orientation. The external RexMeshTool utility can be used for this.
(refer to installation/usage instructions of the MaxScript exporter and RexMeshTool in the export package to ensure they work properly, and to http://www.ogre3d.org for other exporters)
3) In RexMeshTool, you can adjust the size, centering and orientation of Ogre meshes before uploading to the world.  The realXtend coordinate unit is 1 metre (as seen in the dot spacing of RexMeshTool); typically meshes appear large at first in the tool, because some other unit was used in the modeling program.
     - Adjust size to something manageable like a couple of meters; remember you can also scale the mesh to the underlying prim later in-world.
     - The orientation should be adjusted so that the model appears upright.
     - When you're done, click "Save Changes & Exit"
4) Next, in the realXtend viewer, you can proceed to upload the .mesh file into the world (if you don't have a 3D model handy right now, there are some examples in the example_assets directory), from the File menu -> Upload 3D Model. Choose a descriptive name and press Upload.
5) Note that the 3D model appears into your inventory in the folder "3D Models".
6) Now you can create a prim that shall become the 3D model.
7) Edit the created object, and from the reX subpanel of the object editing window, check the box "Extended properties".
8) Drag & drop the uploaded 3D model from your inventory into the Mesh Name combo-box, and the prim should transform into the 3D model.
9) Upload textures for the 3D model as necessary; go through the Material Index selector and select a texture for each index by using the Material Name combo-box. Of the example 3D models, the rock & the fireplace have only 1 submesh and therefore only 1 texture, but birch.mesh has 2: one for the trunk and one for the branches & leaves. NOTE: the less there are submeshes/textures per model, the better for rendering performance. 8 is the upper limit in realXtend; if there's more submeshes, one cannot set the textures for them, and they will be untextured.

How to add a sample particle script to an object
1) In realXtend viewer, select File menu -> Upload Particle Script. From the example_assets directory of the viewer, choose fire_small.particle. Name it for example "Fire" and press Upload.
2) Note that the Fire particle script appears in your inventory in the "Particle Scripts" folder.
3) Create a prim, for example a simple box is fine.
4) Edit the created object, and from the reX subpanel of the object editing window, check the box "Extended properties".
5) Drag & drop the particle script from your inventory to the particle Script Name combo-box. The effect should enable itself; you should see a fire effect on the prim. Note that this example script uses the inbuilt Flare material in the viewer's Media directory; no textures need to be uploaded to the world.
6) When you want to disable the particle effect, you can either uncheck the "Enable" checkbox, or select None for the Particle Script Name.

Things to note about particle scripts
- If multiple particle systems are defined in the script, they all will be enabled at once in the object
- The ColourImage affector cannot be used
- In addition to clientside inbuilt materials, one can use world textures in particle scripts. To do so, copy the texture's UUID by right-clicking it in your inventory and  select "Copy asset UUID"; then paste it to the particle script into the material definition.
- Furthermore, the UUID can be followed by a modifier (separate it with a space)
  fb fullbright, sets lighting to maximum even at nighttime
  add additive blending
  addnodepth additive blending with depth-checking disabled
  salpha solid alpha (alpha reject mode instead of blending)
  fbadd fullbright additive blending
  fbaddnodepth fullbright additive blending with depth-checking disabled
  fbsalpha fullbright solid alpha
  ts two sided (makes the particles two sided, useful for non-point particles)
  fbts fullbright two sided
- For example, the line material 00000000-0000-1111-9999-000000000005 fb would use the default Hardwood texture of Opensim in fullbright mode.

Asset replacing
- In the RexServer, one can enable name-based asset replacing from the opensim.ini configuration file. This means that if an asset of a certain type (for example 3D model) and certain name already exists, and you upload the same type of asset again with the same name, the old asset will be replaced.
- When replacing a 3D model, it is necessary to exit & restart the realXtend viewer to see it change.
- Replaced particle effect scripts on the other hand become immediately visible, when you disable & re-enable the particle effect on an object.



Land texturing

1. Terrain textures
Terrain textures can be selected from region/estate settings with proper permissions. Click on a texture shown on region/estate ground textures tab to select a new terrain texture from inventory.
(Note: terrain textures have a maximum resolution of 512x512).

2. Texture height values
Below each texture there are low and high values. The low and high values are used to determine the gound height where the texture in question is shown. Overlapping values blend the textures together. Unlike in Second Life terrain textures are used across the whole region by using the low and high height values.
 

In realXtend the elevation ranges are used as described below:


Skybox texturing

RealXtend can use texture assets as skybox textures. They can be changed from the Startup section in OpenSim.ini configuration file by specifying each skybox face asset id's.

Example Startup configuration in OpenSim.ini with skybox information:

[Startup]
gridmode = False
physics = basicphysics
asset_database = sqlite
worldlibraryfolder = True
skybox_front = 97276bd7-854d-4b00-8ca6-1bd252f36ef2
skybox_back = 3067c903-e344-4d9a-8fb9-8c1a3443404f
skybox_left = 207c1353-df12-4294-8bc6-42a28d7684f6
skybox_right = 44195ad5-c07a-4975-b3a9-abd9f4732572
skybox_top = d85a89d9-eb2a-4f94-91ad-e621687227cc
skybox_bottom = 2e2409ba-bb4e-43fc-9be7-3387341984ed
replace_assets = True
rex_mode = False
3d_collision_models = True
(etc.)


  1. Media Formats in reX, now and short future plans

How to use a web page or VNC as a texture

 

1. Build a prim

- Right click on the ground and select create

- Select cube (or any other prim type you'd like to create)

- Left click on the ground and the prim gets created

- Make it bigger by pressing ctrl-shift and using mouse at a corner of the prim to scale it


2. Set Click Action to Play media (this is required for VNC only)

- Users have to click the prim to view VNC content

- Web pages are shown automatically

- Close object properties

 

 

 


3. Upload a texture
- File -> Upload image
- Close texture window
- Open your inventory
- Right click on the texture you uploaded from your inventory and choose properties

4. Set Media URL
- Use http://[web address] for a web page or vnc://[vnc address]:[port] for VNC
- VNC screen 0 is usually at port 5900. For example vnc://myhost.com:5900


5. Put it on a prim

- Drag and drop the new texture from your inventory to your newly created prim

- Web pages are shown automatically

 

- If using VNC click the prim to connect to the VNC server. You will be asked for a username and a password depending on the server

 




Getting started with voice chat


  • Connect a microphone or headset to your computer and make sure it works as expected.
  • Start realXtend client and go to preferences, select voice chat tab and enable voice chat.

1. Enable/disable voice chat
When enabled you can hear and speak to other users. If disabled you are unable to hear or speak.

2. Start viewer in Push-to-Talk mode
When enabled voice transmission is controlled with the Push-to-Talk button. When disabled voice transmission starts when microphone input is detected. Automatic voice detection is not yet implemented in realXtend. You should keep this enabled.

3. Use Push-to-Talk in toggle mode
When checked the talk button is used to toggle voice transmission on/off. When unchecked voice is transmitted when the talk button is held down.

4. Set Push-to-Talk shortcut key
Sets a shortcut key for the talk button.

5. Talk button
When using Push-to-Talk mode voice is transmitted when the talk button is held down. If you are using Push-to-Talk in toggle mode pressing the talk button enables/disables voice transmission.

6. Talk button lock
Locks the current state of the talk button.


6. Business security in reX plans

6.1. Example how to connect home automation to reX

 

6.1.1 What is X10Manager

X10Manager is software which communicates with X10 home automation system through power socket and with reX via http connection. The idea is to

establish connection between real life hardware and virtual world objects. You can exp. switch of/off your lamp on your desktop and the lamp object

in virtual world will also turn on/off. It works as well in to another way so you can exp. touch an object in rex and the real life lamp turns on. 

 

6.1.2 How to connect a computer to X10 system

Connect GM11 module to power outlet and connect the module to PC via serial connection cable. If your computer doesn't have serial port you can use usb to serial port adapter.

 

 

6.1.3 How to startup X10Manager

Start X10Manager in command prompt by typing X10Manager.exe <com port> <http port> [client address]


Where <com port>       is the serial port where the GM11 module is connected.
         <http port>       is the http port number where reX should send X10 commands

         [client address]  if given the X10Manager will forward all messages from X10 system to this address

                               This is basically your rex server http address with a port number for X10 connection

                              

exp.

         X10Manager.exe com3 20000 http://localhost:30001

 

        Connects X10Manager with GM11 module with serial port 'com3' and starts listening socket 20000 for incoming X10 messages from rex. It also will send all X10 messages received from X10 system to http//localhost:30001.

 

X10Manager is now ready to communicate with reX server and X10 system. You can get full list of console commands by typing "help" in X10Manager console. You can quit the X10manager by typing 'q' and hit the enter.

 

Note: On Windows Vista make sure that you open command prompt as Administrator.
 

6.1.4 How to configure rex server

 

In X10Connection class ( \bin\ScriptEngines\PythonScript\RXCore\rxX10.py ) change address and port number to correspond your reX server address and port for X10 connection. Make also sure that X10Manager server address is correct.

            

6.1.5 How to connect an object with real life hardware

1) Create an object
2) Set rex class name to sampleX10.Lamp
3) write the X10 device address to objects name field

 

After this your object state will change in every time you touch it. The color of object will change with objects state. You can create multiple objects with different device addresses.

            
            

6.1.6 How to modify object behaviour  

The functionality is done with pyhton scripts so please check the chapter 3 first if you are unfamiliar with python scripts and reX.

 

See Lamp class in file  \bin\ScriptEngines\PythonScript\Samples\sampleX10.py. In this class you have to define the switch on/off logic and state change behaviour.

            
  

 

 

 


 

 

    (TODO)

7. reX teleports between grids and to/from Second Life

The realXtend client recognizes new parameters that can be sent through the llMapDestination script command to enable teleporting between grids, and to/from Second Life. One can set such scripts to objects and they will then function as teleporters when one touches them. Because currently we have no way of telling what user credentials should be used in the destination world, a new kind of popup will appear asking for the username & password. The way how it functions technically, currently, is that the realXtend client will be shutdown and restarted with correct commandline parameters, when one confirms the popup dialog by pressing "Teleport".


7.1 Teleporting to any world


To teleport to any loginuri, start the LLMapDestination destination url with rex:// prefix. For example, a teleport to OpenLife grid:

default
{
     touch_start(integer num)
     {
          llMapDestination("rex://logingrid.net:8002", <100, 100, 0>, ZERO_VECTOR);
     }
}

This will always bring up the teleport popup no matter in which world one is currently in.

7.2 Teleporting to Second Life


Teleports to Second Life can be done as usual, by using the sl:// prefix. For example to Ahern:

default
{
     touch_start(integer num)
     {
          llMapDestination("sl://ahern", <100, 100, 0>, ZERO_VECTOR);
     }
}

When already in Second Life, this functions as usual; the map window will appear, pointing the destination location. However, in other worlds, this will bring up the teleport popup.




8. Compiling the realXtend viewer (on Windows)

Currently, up-to-date project/solution files exist for Visual Studio 2005 only.

Either Visual Studio 2005 or Visual Studio 2005 Express can be used to compile the viewer. For Express, make sure you have the
Platform SDK and DirectX SDK installed from Microsoft's website and that the development enviroment has been configured to use their
library & include directories.

Because the realXtend viewer is based on the Second Life client, Linden Labs' documentation on compiling can be helpful too, see
https://wiki.secondlife.com/wiki/Get_source_and_compile

8.1 Required other tools

Compiling requires Python.

Download & install from http://www.python.org/download/

8.2 Preparing enviroment variables

After extracting the realXtend viewer source code, set the enviroment variable REXVIEWER_SRCDIR to point to the directory you
extracted it to. This is for "copyrex.bat" (referenced later on) to work correctly.

8.3. Proprietary libraries & includes

Some proprietary libraries are left out of the viewer source. These need to be downloaded separately and placed to the correct
directories:

8.3.1 OpenGL headers

The following files need to be downloaded and placed into linden\libraries\include\GL directory of the viewer source:

glext.h
glxext.h
wglext.h

They can be downloaded from http://oss.sgi.com/projects/ogl-sample/sdk.html

Alternatively, if the link is down, you can try
http://www.opengl.org/registry/api/glext.h
http://www.opengl.org/registry/api/wglext.h
http://www.opengl.org/registry/api/glxext.h

8.3.2 Quicktime

Download the Quicktime Windows SDK from http://developer.apple.com/quicktime/download/ (you need to register)


Create a subdirectory "quicktime" to linden\libraries\i686-win32\include, and copy all header files (.h) from the SDK
there, including the CoreFoundation and GNUCompatibility subdirectories.

Copy the file QTMLClient.lib from the SDK to linden\libraries\i686-win32\lib_release & linden\libraries\i686-win32\lib_debug

8.3.3 Skype4COM.dll

Download Skype4COM.dll from https://developer.skype.com/Docs/Skype4COM/Start

Copy the DLL to a system directory (for example C:\Windows) and register it
using the following command in a command line prompt:

regsvr32 skype4com.dll


8.4 Compiling

Open the solution file "indra_complete.sln" from linden\indra\indra_complete directory.

Use the "ReleaseForDownload" configuration to compile the viewer.

Depending on your Cygwin version, the file indra.y in the lscript_compile_fb subproject may produce errors. In that case,
right-click it in Solution Explorer and select Properties -> Custom Build Step -> General. Check the command line; if the line
"C:\cygwin\bin\mv.exe ytab.hpp ytab.h" fails, check what file Bison is producing instead of ytab.hpp, and modify the line accordingly.
 

8.5 Compiling the Avatar Generator

After checking out the avatargenerator module from SVN, it should compile pretty much out-of-the-box by opening
avatar_generator.sln from the checkout root directory. Use "Release" configuration to run optimally.


8.6 Running & making installable packages

The batch file "copyrex.bat" in the root of the source exists to make a fresh executable directory of the realXtend client
after compiling, with all (but only) the necessary files. When you execute it, it creates a subdirectory "out" and copies files (the
enviroment variable REXVIEWER_SRCDIR needs to be correctly set).

After running copyrex.bat, you should be able to execute realXtend.exe from the "out" directory.

To use Avatar Generator successfully (so that it sees the same 3D models etc. as the viewer) it should be placed into a
subdirectory "avatar_generator" within "out" and have its "bin" and "data" directory trees copied there, ending up with a directory
structure like this:

out
out\avatar_generator
out\avatar_generator\bin
out\avatar_generator\data

By using the Nullsoft installer system (NSIS) you can create an installer package out of the "out" directory. The necessary installer
script (realxtend.nsi) & splash screen (splash.bmp) are in the root directory of the realXtend viewer source.

Note that the Avatar Generator itself does not care of its directory name, but the installer script expects it to be found in the
"avatar_generator" subdirectory.




9. Exporting avatars from 3D Studio Max


Instructions on how to export animated avatars for use with realXtend, using 3D Studio Max.

The basic principles are also useful with other modelling tools such as Blender; you should have an exporter that is able to produce animated Ogre mesh & skeleton files.

9.1 Prerequisites

- Get realXtend Export Tools 0.3 from http://www.realxtend.org/page.php?pg=downloads

- Extract the tools package to a temporary directory on your hard disk.

- Follow the instructions in the file "Tool installation and use.txt" to set up the Ogre Maxscript based exporter (MaxScriptExport) and RexMeshTool.

- After this, you should be able to execute the following programs/batch files from
  the command prompt: (if not, doublecheck that you added RexMeshTool's directory
  to the PATH enviroment variable; Control Panel -> System -> Advanced ->
  Enviroment Variables)

  rexmeshtool.exe
  ogrexmlconverter.exe
  xml2mesh.bat


- You should also be able to bring up the Ogre exporter in 3DS Max. (if creating an icon for it doesn't work, creating a key shortcut for it in Customize/Customize User Interface should be easier)

9.2 Exporting the mesh, skeleton & material

- Now load your avatar 3D model in Max. It should have at most 2 materials; the first for the body texture and second for the head texture. Just 1 material for the whole avatar is also fine.

- If your avatar is skeletally animated, it should be set to its base "idle" pose for now (if you have different animations/poses in different Max files, load the one with the idle pose). Also note that skinning has been extensively tested only with the Skin modifier.

- For head tracking to work (biped avatars only), the avatar should have a Biped skeleton with bones named Bip01, Bip01_Head etc.

- You should also have an empty directory for exporting, let's assume for example D:\RexExport

- Select your avatar model, and bring up the Ogre exporter. Choose destination directory & filename for the exporting (no file extension needed). For purposes of this tutorial we're using the example name YourAvatar

- See that the Export Mesh, Export Skeleton & Export Material checkboxes are all enabled. Do not add any animations yet into the Skeleton panel. Then press the "Export !" button.

- If there were problems, refer to MaxScriptExport's documentation. For now, let's assume exporting all of the mesh, skeleton & material were successful.

- Open a command prompt and go to the export directory. There should be YourAvatar.mesh.xml & YourAvatar.skeleton.xml -files, and the YourAvatar.material -file.

- Open the .material file, and check that the material names are somewhat sane. If not, change them BOTH from YourAvatar.mesh.xml and the material file (the names must match or else the materials won't be displayed correctly)

- Copy any texture images you need to the export directory. See that the filenames match those defined in the .material file.

- Now run xml2mesh to produce the actual binary Ogre .mesh & .skeleton files that can be used by realXtend:
 
  xml2mesh YourAvatar

- Open the avatar mesh with RexMeshTool to see that it looks OK. Do not apply any scaling/rotating yet; scroll with the mouse wheel if the model is too large!

  rexmeshtool YourAvatar.mesh     

- If the model looks too dark, you can try removing the diffuse/ambient etc. definitions from the material file, and leaving just the texture image definition.

9.3 Exporting animations

- Now load the Max file with the animation(s) you want to export for your avatar.

- Again, select the avatar model and bring up the Ogre exporter. This time, uncheck "Export Mesh" & "Export Material" checkboxes, and make sure only "Export Skeleton" is checked.

- Choose the same export directory, but a different file name this time. For example YourAvatar_Walk for the walk animation.

- Into the Skeleton panel, input the frame range of your animation, its name and length (set length 0 for the Ogre exporter to calculate it automatically based on your Max system framerate). Then click Add. If you have several animations defined on the timeline, repeat for each of them.

- By using the realXtend avatar definition .xml file (referenced later) animations can have any names. But it's good to stick to the default naming convention that's used for the Jack (default) avatar:

  Walk - walking
  Stand - idle (breathing etc.)
  Crouch - crouch walking
  Run - running
  Hover - hovering while in Fly mode & not moving
  Fly - actual flying animation

  (for the complete list of animations, you can open Jack.mesh from realXtend viewer's
  media\models\avatar directory in RexMeshTool), or look into the definitions in  
  app_settings\ogre_avatar_animations.xml

- When all animations from this Max file have been added, click "Export !"

- In the command prompt, run xml2mesh again to convert the .skeleton.xml file you just produced into a binary .skeleton file. Do not mind the error message caused by the missing mesh file (as we exported only a skeleton this time). For example:

  xml2mesh YourAvatar_Walk
 
- If you have more Max files with different animations, repeat from beginning of step 9.3 for all of them (choose a different export filename each time).

9.4 Merging animations

- When all animations are ready in their respective .skeleton files, it's time to merge the animations into the original YourAvatar.skeleton file.

- Open YourAvatar.mesh with RexMeshTool again:

  rexmeshtool YourAvatar.mesh

- Do not touch the scale/rotate controls yet either; scroll with the mouse wheel to zoom away if the avatar's too large!

- Instead, click the "Merge anims from skeleton" -button. A file selection dialog appears where you should be able to select any of the extra skeletons you produced, like
YourAvatar_Walk.skeleton

- After merging each extra skeleton, check the Animation combobox that the new animation(s) appear correct.

- After all skeletons have been merged, click "Save changes & exit".

9.5 Finalizing the avatar

- Now open YourAvatar.mesh with RexMeshTool one more time.

- Use the X/Y/Z Rotate controls to ensure the avatar is upright and has its back turned to you.

- Use the Scale or Size controls to set a sensible size for the avatar. Remember that realXtend coordinate unit = 1 metre inworld. When you find a good size, save the "scale" value for later reference.

- Use the X/Y/Z Align controls to set the mesh pivot point to its bottom center point (typically at the feet for biped characters). Note: if the pivot point is already OK, leave the X/Y/Z Align controls empty or to the None-setting.

- Refer to the existing avatar meshes in realXtend viewer's media\models\avatar as necessary.

9.6 Copying files

- To be able to use the mesh in realXtend viewer & Avatar Generator, the files need to be placed into the correct directories within the viewer installation:

  YourAvatar.mesh & YourAvatar.skeleton into media\models\avatar

  YourAvatar.material into media\materials\scripts

  Body textures into media\materials\textures\avatar_body

  Face textures into media\materials\textures\avatar_face

9.7 Avatar description .xml file

- The avatar's animations and other properties (like the appearance controls seen in Avatar Generator for Jack & Kate avatars) are defined in an .xml file named after the avatar mesh, so YourAvatar.xml for YourAvatar.mesh

- This file is also placed into media\models\avatar directory within the realXtend viewer installation.

- The definition file isn't strictly necessary; if it doesn't exist or doesn't have any animations defined, the default animations from

  app_settings\ogre_avatar_animations.xml

  will be used.

- For a minimal example of an avatar .xml file, see Mushroom_bone.xml in media\models\avatar. This defines the run, walk & crouchwalk animations to refer to an animation named Walk (the only one that exists for the Mushroom avatar)

- The animation definition parameters are the following:
 
  name
  - identifies the animation definition. Otherwise not used internally, but "WALK" has special
    meaning: in Avatar Generator one can choose different walk animations (the alternate
    walk animations should have Walk prefix in the name)
  uuid
  - Second Life UUID of the animation. These are sent from the world server and we need these
    to know what animation it is! Copy this value from the defaults; do not modify it.
  ogrename
  - What animation name in the avatar's .skeleton file should the UUID should map to
  looped
  - Whether the animation should loop, true or false
  speedfactor
  - Adjusts animation speed. It's a multiplier, 1.0 is the original animation speed, and 2.0 would
    be twice as fast.
  usevelocity
  - Tells to adjust the animation speed based on avatar's movement velocity, true or false.
    Typically set true for walk/run animations, and false for others.
  fadein
  - Animation blend-in time in seconds, when starting the animation
  fadeout
  - Animation blend-out time in seconds, when stopping the animation

- Note that when you change the .xml description file, you need to re-select the mesh in Avatar
  Generator (thus resetting the avatar) and re-export to Avatar Storage to see the changes.