SLS-1 The Avatar and its Mesh

Free Preview

This is a course about the technical details of the Second Life Avatar. We will examine in great detail how this character is constructed and shaped, and we will explain the implications on the creation of mesh attachments and mesh characters.
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.

Note: You do neither need to be a Blender-user nor do you need to have Avastar in order to follow this course.

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)
1-01
When we take a closer look at the avatar, then we realize that its surface is a mesh made out of vertices and polygons. This is the avatar’s surface, the part that holds the textures you know as skin in Second Life notation.
Furthermore, when we examine the SL character in even more detail, we see the character does not only have a surface, but it also contains a Skeleton, which is made out of Bones.

1-03

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:

Observation: Some sliders modify the Skeleton, while other sliders only modify the Mesh volume and let the Skeleton unchanged. Think of the real human body as an analogy: The human skeleton defines the overall proportions of the body (its overall length and the distance of the hips for example) while muscles, fat and tendons define the Body shape (its volume).

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.

1-04

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

When you try create an Avatar with a semi transparent skin (using the alpha channel of your textures) then you will quickly realize that does not work. Avatar skins do not support (ignore) alpha layers in the textures! However in SL you can define alpha masks which allow to hide parts of the avatar mesh. Hence we can use a little trick to simulate a simple wireframe mode by creating a partial Alpha mask:

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
eye_uv

Eyes

head_uv

Head

upper_body

Upper Body

lower_body

Lower Body

Note: If you don’t have Avastar, you can use the Avatar Workbench instead

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

In Second Life create a new Alpha mask. You can do this from within the Inventory:

RMB -> New Clothes -> New Alpha mask

Now wear the Alpha mask and in the inventory:

RMB -> Edit

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.

1-05

 Hello, World on a Wireframe1

1-07

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.

  Mesh: trouble ahead!

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):

Observation: our own mesh creations do only react in a very limited way to the Shape keys.


In fact only the bone changing sliders do influence the mesh based attachments and characters. That is, mesh attachments can not be fully customized by using Shape sliders. This restriction is a major problem with mesh attachments. We will get into more detail below.
1-08

Body-Fat:0

So, you noticed the caveat ? Check what happens when you move the Body Fat Shape Slider. You will see that the Avatar will change its shape, but the Skeleton (which is a mesh character on itself) does not care about muscles. Well, in this case the mesh behavior is actually very welcome, because a skeleton does not have muscles…
1-09

Body-Fat:100 (Skeleton remains unchanged)

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:

  • Head
  • Upper body
  • Lower body
  • 2 separate eyes
  • Eye brows
  • Skirt
  • 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.

mesh_avastar_explode

The Meshes

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:

1-10

Head Mesh

1-11

Upper Body Mesh

1-12

Lower Body mesh

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:

In 3D Modelling: A Face is defined by a set of edges which are all connected such that the ending vertex of one edge is also the begin vertex of the next edge, and the last edge’s end point is connected to the first edge’s start point. Thus the edges are forming a closed path (or a closed loop). The area that is surrounded by the closed path is named a Face.
1-13

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.

Polygons

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”.

 

Face Types

  • 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.


UV Maps

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.

headUVMap

Head UV

upperBodyUVMap

Upper Body UV

lowerBodyUVMap

Lower Body UV

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 ?

Very brief answer: The UV Maps of the Head, the Upper Body and the Lower Body all cover the entire UV space. The UV space is (typically) defined in the range U=[0 … 1] and V=[0 … 1]. When we join the 3 body parts into one single mesh, then the resulting UV Map would look very awkward (see image).

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.
1-15

Joined UV Map for Head, Upper Body and Lower Body


The SL Skeleton

The SL Avatar also has a skeleton as already mentioned above. The yellow Stickman from above was only used for visualizing the Avatar’s skeleton in second Life. In my modelling program (Blender) i do not need this visualization, because the program already has one ready made for me.

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.
rigging_05

The SL Avatar’s Rig (Skeleton)

Sidenote: More about Bones…

[ps-include path=”/avastar/reference/fragment-bones-and-more”]

The Rig’s Orientation

It may sound trivial, but actually it is one of the ugly pitfalls of the SL Avatar:

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.

Why it matters: The reason why we can struggle easily here is: Blender expects that a character is modeled looking forward along the negative Y axis. And all Blender mirroring tools (for modelling, weighting, posing, animating, …) expect that the symmetry plane for a rigged character is the Y-Z plane. Hence if your model uses a different symmetry, then blender just can not handle this reliably.
1-14

SL Avatar with Rig oriented along positive Y

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

The Skeleton bones are weighted to the Meshes with exactly the same weightmaps as are used in Second Life. Thus all animations which have been created for the Second Life Avatar will work with this mesh model as well.

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
stick_shapes

Sidenote: More about Weight Maps…

[ps-include path=”/avastar/reference/fragment-bone-weight-maps/”]


Please note that the rig in this lesson only uses the Second Life Base skeleton, which contains the 21 essential bones of the rig (the blue bones). Actually there are many more bones defined, but i will keep these extra bones out of sight for now.

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.
1-16

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.

Back to: The SL Skeleton Course > SLS Basics

5 Comments

  1. chloebenoir

    I am wondering why your screen is so bright and you can see the mesh body properly and why mine is dark

  2. chloebenoir

    Also what points to I actually really have to remember from this lesson.

  3. chloebenoir

    Hi when I import the object files they appear sideways in avastar. How do I fix this..I have tried the rotation menu option though cannot actually rotate.

  4. joey301

    I hope I can come back to this after I mark it complete

    • Gaia Clary

      Sure. You also can reset the mark at any time if you like.