The SL/OpenSim Skeleton
!!! DRAFT !!!
Creating avatar workbench and Avastar has given us a great deal of insight on the SL avatar. The goal of this tutorial is to give you a detailed information
about the construction of the OpenSim avatar and what you can do with it.
We will also talk about some areas where we simply do not know what happens, or where there are inconsistencies and the techniques are highly experimental. We’ll update the page as we learn more.
In a nutshell the OpenSim Skeleton supports:
- 26 Main bones
- 32 Attachment points
- 24 Collision Volumes
- 120 Shape parameters (the shape sliders)
We will talk about all of them here.
The Base Skeleton
The skeleton uses 26 bones for driving
- the body (split into two meshes upper and lower),
- the head and hair meshes,
- the skirt mesh,
- the eye meshes.
The Main Bones
All 26 available main bones: mEyeLeft, mEyeright, mSkull, mHead, mNeck, mCollarRight, mCollarLeft, mShoulderright, mShoulderLeft, mElbowRight,mElbowLeft, mWristRight, mWristLeft, mChest, mTorso, mPelvis, mHipright, mHipLeft, mKneeRight, mKneeLeft, mAnkleRight, mAnkleLeft, mFootRight, mFootLeft, mToeRight, mToeLeft
Note: The 5 Bones marked in blue are not used for weighting of the default Avatar
But note that some of these bones are not used for animating the default avatar. These are in detail
- the skull: mSkull,
- the toes: mToeLeft and mToeRight,
- the feet: mFootLeft and mFootRight.
So only 21 bones are effectively used to create animations, and only these bones are associated with weighting information for the default mesh. That is, even if you animate the remaining 5 bones, the animation will not contribute any skin movement to the default character.
However, we will see later that you can use all 26 bones for weighting and animating your own custom meshes. Note that from a technical viewpoint mesh attachments and complete Mesh characters are handled in exactly the same way.
Shape keys and Morphs
In the editor you find 3 sections with 23 shape parameters for the body, torso, and legs. Another 6 sections with 55 shape parameters for eyes, ears, and mouth, as well as for the nose, chin, and the head form. In addition there are 42 controls for the clothes morphs.
Each shape parameter may drive multiple others, and they not only change the shape of the mesh, but they also influence the scale and location of the bones. We also can apply shape changes which do not affect the skeleton itself, like breast size, or a bigger nose for example.
These changes are implemented via shape morphs.A shape morph defines 2 configurations of the mesh and a linear transition of the vertices between the 2 mesh states. When you move the corresponding slider from the left to the right the mesh continuously changes from the initial morph state to the final morph state.
Note that some sliders can drive several mesh morphs over the range of the slider.So, when you just work with the default avatar, then you can create small and fat avatars as well as large and slim characters only by adjusting the shape parameters according to your taste. You can do all of that in your Viewer without need to use an external 3D tool.
If your 3D world supports mesh items (like OpenSim, RealExtend, inWorldz and others…), we also can create our own character meshes. We can create mesh based attachments for either the standard character or for our own mesh based characters. But our own mesh creations do only react in a very limited way to the Shape keys.
In fact only the bone changing shape keys do influence the mesh based attachments and characters at all. That is, mesh attachments can not be fully customized by using Shape keys. This restriction is a major problem with mesh attachments. We will get into more detail below.
Shape and Skeleton matching
It is important to always remind that your Avatar Shape settings in your viewer effectively change your skeleton! Consequently that means, we do not have one defined skeleton!Actually we have a parameterized skeleton which gets influenced by 20 of the available shape parameters, each having a value range from 0 to 100, thus the set of possible skeleton configurations is virtually infinite. And this makes it very complicated to create mesh attachments which really fit to your particular shape.
This problem can be avoided if we use the “Default SL Shape” for our work in the 3D Editor. However this is not always desirable because often we want to create mesh attachments which fit to a specific Avatar shape. Actually we want to create attachments which fit to any shape.This is where the “Mesh deformer project” steps in. This project is one attempt to solve the shaping issue by calculating how a mesh must be deformed such that it keeps “in shape with the shape”, that is, the shape keys change the character shape, which in turn drives the mesh deformer which will finally change the mesh attachment shape.
Shape parameters influencing the skeleton
|The list of bone length changing Shape keys. Please note, the shape keys marked in orange do also influence the Collision Volumes (see next chapter)
So the “Mesh Deformer project” will allow you to fully customize your mesh attachments provided you have created them by using the “Default SL Shape”. We have not yet found a valid specification for that shape. We also do not know how it differs for male and female.
Collision Volumes (Fitted Mesh)
Interestingly these volumes are also counted as full bones, and they can be animated and weighted just like the standard bones. The most interesting property of these bones is that they get moved and scaled by some of the shape keys. Weighting mesh clothes or avatars to these bones means they will respond to the Shape keys, for example Torso muscles.
But note that only a very small fraction of the Shape sliders actually does influence the Collision Volumes. thus you can not expect to get a full control over your mesh object by using the Collision volumes. For example changing the breast shape is not at all mapped to collision volumes. As well as facial expressions are not supported.
Shape keys and the Collision Volumes
This is the list of Shape keys which do affect the Collision Volumes. Please note, the shape keys marked in orange do also influence the Bone length (see previous chapter)
|Body||Height, Body Thickness, Body fat|
|Head||Head Size, Head Stretch, Head Length|
|Torso||Torso Muscles, Neck Thickness, Neck Length, Shoulders, Arm Length, Hand Size, Torso Length, Love handles, Belly Size|
|Legs||Leg Muscles, Leg Length, Hip width, Hip Length, Butt Size, Saddle Bags, Knee Angle, Foot Size|
Besides the 26 standard bones and the 19 Collision Volumes we have attachment points. An attachment point is simply a location where you can attach (wear) other objects. The locations of the attachment points are fixed relative to a particular bone in the skeleton. Thus you might believe that there is not much to say about these points, but technically the attachment points are just another set of bones in the skeleton.Indeed it is possible to animate attachment points in the same way as you can animate the skeleton bones, and anything you’ve attached to those points will go along for the ride with the animation itself. These bones can also be used for weighting custom meshes just like the standard set of bones.
By experimenting with these bones we found some undesirable side effects, which may be due to the fact that weighting and animating these bones has never been seen as a valid option.
The main limitations we’ve discovered are:
- Some attachment points have spaces in their name. Collada 1.4 doesn’t support bone names like this consequently a bone like “Left Shoulder” is interpreted by the Collada Importer as 2 bones with the names “Left” and “Shoulder” respectively, thus the Collada data will be invalid.
- There is no rotation reset. Unlike the normal bones, stopping an attachment bone animation will leave the bone in the last rotated position. To fix you need to run an animation which rotates the bone to zero again.
- Again unlike normal bones it doesn’t appear possible to change the location of the bone with a custom mesh import (Adding joint offsets to attachment bones). Either it gets ignored or the entire armature gets distorted.
We believe that your viewer should be able to use the attachment points exactly like all the other bones, and thus give us 32 extra possibilities for weighting and animating our meshes, and that the existing limitations should be viewed as bugs. But currently it is not possible to weight attachment points in a reasonable (safe) way.
What we have so far
So we have effectively 77 bones available for animation and rigging. Furthermore 20 Shape keys do influence bone lengthes, and 23 shape keys do influence the Collision Volumes. All together (when combining the bone shape keys and collision volume shape keys) we find that 30 Shape keys do influence the mesh and its skeleton provided it is correctly rigged and weighted.So far this is what we found by inspection and experimentation and this reflects our current knowledge about the Skeleton. In the following chapter we will take a closer look on practical issues.
The Skeleton and the associated Shape key system provide:
- 26 standard bones
- 32 attachment points
- 24 collision volumes
- 120 Shape keys
30 of the shape keys influence the Mesh and/or the Skeleton and thus they can be used for limited customization of custom meshes.
Rigging and Weighting
Lets take a look at an example.
this is a low poly mesh made for game engines. When we want to prepare this mesh for our 3D world, then we have to do following preparations:
- First we need to setup the skeleton itself.
Here we have to take care about the bone hierarchy and about the exact bone names. Otherwise the skeleton is rejected by the mesh importer within your viewer. We believe that you can find an appropriate rig for each of the major 3D editors.
- Now we need to find the best fitting Shape for the character.
- Then we have to add animation data, that is, we have to weight the mesh against the 21 standard bones.
- Finally we have to get our creation into our online world. This is done by exporting the mesh from your 3D editor to a Collada file. We provide Collada 1.4.1 here (This is compatible to 3D worlds which use the skeleton described in this document). The used file extension is “.dae”.
There are some caveats in this process, which might lead to more or less serious issues with your mesh. You have to take care about:
- Your mesh must always be weighted to all 21 Skeleton bones. That is, you have to provide weight information for each bone, regardless whether it is used in your mesh or not. And that means, you have to provide all appropriate weight groups, although they may be empty. If only one of the weight groups is missing, then the mesh will be rejected.
- Your entire mesh must be weighted. If only one vertex is not contained in any of the supplied weight groups, then the mesh will be rejected.
- In most 3D editors you must ensure that your character looks towards the positive X axes when it gets exported. Otherwise you may end up with massive distortions when you wear the character
- If you import a mesh with all vertices weighted to zero, then this mesh disappears as soon as you wear it in the online world. However you can rezz it with no problems.
On a special side note: Although the mesh Importer supports the import of textures along with the mesh, this functionality is currently broken for rigged meshes.
Wearing a rigged mesh
Once you have successfully uploaded your mesh to your 3D world, you can wear it just like any other object by attaching it to an attachment point. However rigged meshes are somewhat special, as you can wear them at any attachment point you like. If the mesh is properly created (weighted) then it will self adjust to the skeleton.
Cancel out the Skeleton Shapes
Here is what you would need to do in principle if you want to create mesh attachments which fit exactly to your in world Shape (attention, this is mind boggling):
- You have to know which shape configuration you use in world. Especially you need to know the values of the 20 Shape parameters which affect the Skeleton.
- You calculate the skeleton configuration which results when applying the shape parameters and setup your skeleton accordingly. This is your working skeleton.
- You setup the working skeleton in your 3D editor and use it to create your mesh attachment.
- When you are done, you have to calculate the difference from your actual mesh attachment to how it would have looked alike if you had created it for the default skeleton configuration. And you have to apply that difference to the mesh. This defacto rebases your work from the working skeleton to the default skeleton. The reason why you have to do that, is that the skeleton shape parameters are already “applied” to your working skeleton. So if you would now simply upload your mesh as it is, then these parameters keep applied and when you wear the mesh, your in world shape will apply the parameters again. And that means your 20 Skeleton shape parameters would be applied twice. Please also note that the default skeleton differs for male shape and female shapes.
- Now you export the rebased attachment to your 3D world.
- Now you can wear the mesh. And if you also wear the correct shape (which you used in step one above) then the shape parameters get applied to the mesh and it now fits 100% and looks exactly like you created it in your 3D editor.
We are proud to tell you that our Avastar product does all of that for you automatically in the background. So you do not need to bother with this at all. But it may be good to know about that issue when you intend to create your own mesh exporter tool.