At the end of this course you have gained fundamental knowledge about constructing rigged meshes (characters and attachments).
Prerequisites for this lesson
- You have an account in Second Life or in OpenSim.
- You have a pose stand that can pose your character into the T-Pose.
- Your Viewer is capable to download your avatar shape in .obj format1, e.g. the Singularity Viewer
- You have installed a 3D modelling tool that is capable to export Collada files which are compatible with Second Life, e.g. Blender
1: For Blender users there is a much easier way to get your current Shape from Second Life into Blender. Please take a look at our Avastar Addon which is capable to import regular Second Life Shape files (avatar shape in XML format)
Your initial skills
Basic knowledge in 3D Modelling
At end of Lesson
Detail knowledge about the SL Avatar’s inner structure.
The Shape Sliders
You most probably know all of this already. You change your character’s shape in the Appearance Editor
- Here you find about 120 sliders for squeezing and stretching all parts of your avatar’s body.
- Each slider can be set to integer values in the range [0, 100]. Thus you can set each slider to 101 possible values.
- The Sliders are grouped into Body sections.
- At the top of the editor you can switch the Gender of your character.
- You can store the slider configuration into Shape Objects.
- New Shape objects are always preset with the Avatar default Shape. (a female shape)
It is important to understand that the bones are not meant as visual elements. In fact the bones are Control handles for manipulating the mesh. So the Skeleton that you see in the image above is just a “visualization” of those control handles.
Note: In 3D modeling meshes which are controlled by a Skeleton are also named Skins. So in order to follow this notation i will refer to the character’s mesh as the character’s Skin in the rest of this course.
In this course i will explain how the shape sliders and the bones control the character’s shape and what that implies for your own attachments and character creations.
Two Types of Shape sliders ?
When you play a bit with the Shape editor, you will quickly realize that some of the sliders change the Avatar-skeleton, like for example the slider for the character height or the arm length slider.
Other sliders only modify the volume of the mesh but they preserve the bone-sizes. For example this is so for the torso muscles and for almost sliders for the face.
This difference in the slider’s behavior has some very important implications for our own custom characters and attachments. That is:
Sidestep: Inspecting the Shape Sliders
Second Life has no nice way to show how the shape sliders interact with the Skeleton. However here is a little mini tutorial for Blender for creating a mesh character that shows how the skeletal bones interact with the Slider system in Second Life:
Create a “Mesh skeleton”
We want to see what the Skeleton does when the mesh sliders move. For this purpose i have created the stickman.blend file (and the stickman.dae file for those who do not have Avastar)
The Stickman is a replica of the SL Skeleton itself. It is already weighted, so that you just can export it(*) , import it to Second Life, wear it and run around as Blender Armature.
(*): You need Avastar to export the stickman.
Note: The yellow skeleton in the image above is a mesh. I created this mesh only(!) because in SL we can not directly see the Skeleton. Thus i faked a skeleton visualization with this Avatar. As a sidenote: Blender’s animation system creates bones which look very similar to what you see in the image above. But we will see later that skeletons (bones) are separate items which are not defined as Mesh objects.
Create “wireframe” Alpha textures
With Blender: Grab the Avatar mesh, then for each part export the UV Layout with an Opacity of 0%
Here is the procedure for the Head mesh:
- Select the Head mesh
- go to edit mode
- Ensure that all vertices are selected
- open the UV Editor
- UVs -> Export UV Layout
- In the operator Panel set
Fill Opacity = 0.0
- Export as .png
After you have created the images, upload them to Second Life. Of course you can use the images provided above as well, (with Firefox you can use RMB -> save image as…) But you also should be able to create these images on your own.
Create the wireframe Alpha mask in Second Life
Now wear the Alpha mask and in the inventory:
In the appearance Editor you can add the just uploaded images. Note that i have enabled the tickmark for the Hair Alpha instead of providing an Alpha texture here. we don’t care about the Hair wig anyways.
Ensure that you wear the alpha mask, then detach all clothes and all mesh attachments from your avatar, and wear the Mesh skeleton that we added in the previous step.
Hello, World on a Wireframe1
Now you can go into your Shape editor and play with the Sliders to see which sliders affect which parts of the Mesh and the Skeleton. But hold on, there is a caveat here. I suggest you take a moment and try to see that caveat by yourself by playing with the sliders.
Hint: With Second Life you always have to expect the unexpected. Now what is the caveat ?
1: The chapter title is a reminiscence of the German film World on a Wire.
Our goal is to create cool and good looking Meshes and attachments. If you have played with the Stickman Avatar (see above in the toggle box) then you might have stumbled over this already (but its easy to overlook, so don’t worry if you didn’t notice it):
However… lets keep all of that aside. We will see shortly in greatest detail what happens and why it happens.
The Anatomy of the SL Avatar
I have prepared an exact clone of the Second Life character. This is a mesh that has all properties of the Second Life avatar. But it lives in my modelling tool (Blender). This mesh has been generated from the Avatar Definition Files in the SL Viewer. Thus it is by all means the same character as used inside your SL viewer. So, all that i tell you from here on is exact information about the SL character as well.
First we see that this character is separated into 8 parts:
- Upper body
- Lower body
- 2 separate eyes
- Eye brows
- Hair Wig
The Hair Wig is mostly not used for any practical work (although i can see it to be of value when you create customizable mesh hair). We will ignore the hair wig. And for now we will also keep the eyes and eye brows aside. we will get back to the eyes later when we talk about animation.
Each part of the character is made out of a mesh, that is a set of vertices (orange points in the images below), connected by a set of edges (orange lines). The holes in this mesh are filled with faces (blue surfaces) and all faces together define the character’s surface (or skin). Here you see the 3 body part meshes rendered in orange and the skin rendered in blue:
If you inspect the images closely then you see that all blue faces are in fact triangles (faces with 3 edges).
Sidenote: Details about Vertex, Edge, Face and Texture Face
You might already have been working with Faces in Second Life. Thus you have an idea about what a Face is.
In Second Life: A Face is an area on the surface of an object that can be textured with one texture. In second Life an object can have up to 8 Faces.
However, in 3D modelling the term Face has a slightly different meaning:
Note: Faces are basic surface elements which have no substructure. That basically means, a face can not contain any inner structure (sub faces made out of inner edges if you like so), thus you can see faces as the atomic parts of a mesh.
Note: Meshes do not need to be made only with triangles. Meshes actually can have have faces with 3, 4, 5 or even more edges. We typically use the names “Tri(angle)” for triangles, “Quad” for faces with 4 edges, and “NGon” for faces with more than 4 edges. Also we often find the word “Polygon” as synonym for “Face”.
- Faces with only 3 edges are named Triangles (or Tris)
- Faces with 4 edges are called Quadruples (or Quads)
- Faces with more than 4 edges are called N-Gons
- And all faces are also named Polygons independent from their edge count.
From Vertex to Model
This video explains in great detail the basics of mesh:
However, most target systems (like Second Life for example) actually only use Trangles. Luckily the conversion from arbitrary Polygons to Triangles can be made automatic (and in fact is mostly done automatic) by all 3D tools.All of this was not a big issue before Second Life supported mesh. But now we have a name clash. And in order to resolve this problem, the term Face in Second Life is often replace by the term Texture Face.
Second Life defines 6 UV Maps for their meshes. Below you find the 3 most important maps (from left to right) Head, Upper Body, Lower Body.
These UV Maps are the same for all SL Avatars and this is true for male and female as well. But most important: These UV Maps can be used to create textures which will work on the Second Life avatar (to make skin and cloth textures for example)
Sidenote: Details about UV Mapping
UV mapping is a technique that allows us to cover a three-dimensional surface with two-dimensional images. The basic idea is (slightly simplified) that the faces of an object are planar and thus you can always find a linear mapping between a face on the 3D model and a corresponding face on a flat plane. In simple words the 3D model is cut into pieces (along seams), then each piece is unwrapped onto a planar surface. The entire set of unwrapped faces is the UV Map.
UV mapping in a nutshell
So for each face of the 3D model we have a corresponding face in the 2D UV map whith the same number of edges. Thus for each of the 3D faces the corresponding UV face can be mapped by stretching and rotating the image only in 2 dimensions.
Admittedly this is a very short introduction into UV Maps, but the video should make it pretty clear how UV mapping is meant to work.
UV Mapping in a video
Why the character is cut into 3 pieces ?
However, you actually can join the parts into one single object. But then you need to work with different materials (one material for each of the joined parts) and assign each mesh face of the joined character to the corresponding part material. But this is not part of this course.
The SL Skeleton
This Skeleton is also named: The Character’s Rig. And the SL Avatar mesh is bound (assigned) to this Rig.
Note: In Blender the skeleton bones are by default colorized in blue. However, when you compare the skeleton in the image aside with the yellow stickman character, (which is a simple mesh, don’t forget that!) then both look very similar. Of course that is on purpose.
I have added an in depth introduction into Rigs in the sidenote below.
Sidenote: More about Bones…
The SL Avatar Mesh
Let us first take a more detailed look on the SL Avatar. Actually the SL Avatar consists of a mesh made out of about 7500 triangles. When it comes to posing and animation all of these triangles have to be moved around somehow. However, it would not be very practical if we had to define the locations of all Mesh faces one by one for every possible pose. And luckily there is a better way to do this.
The SL Avatar has a small set of 26 control elements (bones) which can be moved separately. And we will see in a moment that each bone controls the deformation (bending and stretching) of a specific area of the mesh. Thus these bones are also named Deform Bones. But one step at a time…
So when you move one bone then all its attached neighbors move along with it so that the “skeletal” integrity of the bone system keeps preserved when you animate the bones.
Remember that the primary goal is to move, stretch and bend the character’s mesh such that it appears to act just like a person (or animal/creature) moving in real life.
The trick is that in fact all 7500 faces (or more precisely the movement of the vertices!) of the Avatar mesh are only controlled by the bone movements. So, where is the missing link ?
How do the vertices know how to move ?
There must be a relationship between the bones and the vertices of a mesh. More precise:
- There must be a relationship between each vertex of the mesh and each animating bone.
- And obviously each vertex of a mesh has to be moved by at least one bone.
- Possibly a vertex could even be moved by more than one bone.
Note: In practice each vertex can be moved by up to 4 bones at the same time (this is a limitation of SL and compatible worlds).
The Rig’s Orientation
Second Life expects the Avatar to be modeled such that it looks forward along the positive X axis. Now this should not be such a big issue, but (for Blender) this restriction is awkward.
Enforce compatible symmetry
From Second Life to Blender: You can rotate the Rig such that it complies to Blender’s symmetry:
- Ensure Blender is in Object mode
- Select the Rig and all its attached meshes1
- Now rotate the Rig such that the character looks toward negative Y. For the SL Rig you will rotate along the global Z axis by -90° (Use the keyboard shortcuts: RZ – 90)
- Object -> Apply -> Rotation
- Press the NUMPAD 1 key to enter Front View
Now the character should look at you.
From Blender to Second Life: You can rotate the Rig such that it complies to Second Life symmetry:
- Ensure Blender is in Object mode
- Select the Rig and all its attached meshes1
- Now rotate the Rig such that the character looks toward positive X. For the SL Rig you will rotate along the global Z axis by +90° (Use the keyboard shortcuts: RZ 90)
- Object -> Apply -> Rotation
- Press the NUMPAD 3 key to enter Side View
Now the character should look at you.
1: If your Meshes are all parented to the Rig (are children of the Armature) then it is sufficient to only select the Rig.
Bone Weight Maps
We will get into the details of Weight Maps later. for Blender users: You find the weight maps stored in Vertex Groups. You find more about this in Blender wiki – Vertex Groups
Sidenote: More about Weight Maps…
Bone Weight Maps
A Bone Weight Map defines how much influence a specific bone has on each vertex of a specific mesh. The influence is typically defined in a range from 0.0 (no influence) to 1.0 (maximum possible influence). So if a vertex shows up in a Bone Weight Map, then it will be controlled by that bone. The amount of weight defines if the vertex only slightly follows the bone (weight ~0.0) or moves as if it where glued to the bone (weight ~1.0)
Note: Bone weight Maps are defined per Mesh (as a set of vertex groups, see next chapter)
Visualizing Weight Maps
Weight maps are often visualized directly on their associated mesh by using a color code (where each weight value between 0 and 1 is mapped to a color in a color band. Blender uses by default a color band that maps a weight of 0.0 to the color blue, and a weight of 1.0 to the color red. In between weight values are mapped to the rainbow colors:
Here is an example for the visualization of the Weight Map of the SL Avatar’s mHead bone:
Note: a vertex can be animated by more than one bone in parallel. So it is possible that a vertex can be referenced in more than one Bone Weight Map (thus providing the potential for very complex movements) This happens typically where 2 bones touch each other. In that case the influence is split between the 2 adjacent bones.
SL Avatar Weight maps
Since a Bone Weight Map is always related to a specific bone, that means for the SL Avatar: We have to provide 26 weight maps (one Map per bone) in each mesh that we want to rig.
So a weight map is always related to one bone. And it contains one weight value for each vertex. Well, this is not 100% correct. Actually there is a rule:
The Rule of Zero weights
If a vertex is NOT mentioned in a weight map, then it is assumed to have a weight of 0.0 for the related bone. This rule helps to keep the bone weight maps reasonably small because now the map only needs to contain those vertices which are actually controlled by the bone.
You can see in the next image, that indeed most areas of the SL Avatar are assigned to only one bone, thus the above rule helps to avoid unnecessary clutter in the Weight Maps. The image shows areas with different numbers of “weights per vertex” for the SL Avatar.
So you can see that most vertices of the Mesh are actually controlled only by one Bone. And you can see that typically near the bone joints we find 2 weights on the vertices.
Note: Remember that each vertex has to show up in at least one weight map, otherwise you get an error “unweighted verts in mesh” when you try to import your mesh to SL or compatible worlds.
However, please be patient, we will get into all of this later in much greater detail. For now you only need to know that this mesh is an exact copy of the secondlife Avatar and it uses the exact same Rig as the SL Avatar. And because of this we expect that this mesh will behave exactly in the same way as the Second Life character itself.
In the next lesson we will check if this is a correct assumption. And note: What we will see next is not dependent on the modelling software that you use. Your tool must only be capable to create mesh objects and it must be able to export your meshes to the Collada format.