Skinning

Skinning (weighting your mesh)

Glossary: Skinning

Skinning is the process of creating an association between a Mesh (the Skin) and a Rig. More specifically in the Skinning process we define associations for each bone of the Rig’s Skeleton to each vertex of a mesh. In practice, for a polygonal mesh character, each bone is associated only with a subset of the character’s vertices.[break] Portions of the character’s skin can be influenced by 2 or more bones, where each vertex of the affected area gets an influence factor to each associated Bone. This factor is also called Vertex Weight. Thus the influence of each bone on a specific Vertex is defined by its Vertex Weight.

The process of Skinning includes:

  • Binding the Character to the rig in a specific Pose (basically establishing an association between the Rig and the Mesh)
  • Weighting the Mesh to the Armature bones (create the Vertex Weights)

The Skinning Panel

Once you have bound your custom mesh to an Avastar rig, the Skinning panel changes as displayed in the image aside. We now see 3 subsections:

  • Appearance Control: To Enable/disable the Avastar Slider System
  • Weight Map Control: To automatically create weight presets for the selected Custom Mesh
  • An Unbind from Armature Button to disconnect the Custom mesh from the Avastar Armature
Image410

Appearance Control

You can switch between the options:

  • No Sliders: Any changes in the Slider system are not forwarded to the Mbound meshes
  • SL Appearance: Meshes react to Sliders identical to SL Appearance Sliders.
  • Shape Keys: (only with Sparkles)
Image411
  • When you click on the SL Appearance Button, then Avastar adds 3 data sections to the Mesh Custom Properties:
    • original: Stores the vertex locations of the original Mesh
    • neutral_shape: The vertex locations with all sliders set to neutral
    • bone_morph: The vertex locations using the current slider values
  • The bone_morph custom property is updated whenever a slider is moved.
  • When you later reset the Mesh to No Sliders, then the original mesh is restored from the Custom Property original
  • When you Apply Slider, then the Data in the bone_morph section is stored (baked) into the mesh and the Appearance Control is set to No Sliders
  • When you click the Reload icon (right to the Apply Slider Button) this is like Apply Slider, but the Appearance control remains in the mode SL Appearance.

Note: Avastar’s default Shape is exactly the same as the SL Default shape that you get when you create a new Shape in the SL Viewer, see images below for comparison:

Image008

Avastar Default Shape

default_shape

SL Default Shape

More about the Reload icon

Now this is rather complicated to explain. The most important point here is that the Bone weight Panels do a lot more than just controlling how the mesh bends when animated. In fact Bone weights are used to apply the entire “Joint Matrix” of the influencing bones to the mesh. That is in simple words, Bone weights can be used to scale your meshes as well.

You might be very astonished about this, because the Avastar Armature does not use Bone scaling at all. Also the default Avatar that you see in the workbench or in avatar.blend does not have Bone Scales (all are set to 1.0). But the SL viewer makes heavy usage of Bone Scaling in its Shape editor.

Now back to Avastar: Avastar does not use Bone scaling like the SL Viewer does, but rather directly scales the Meshes and thus keeps the Bone scaling always at 1.0. So, whenever a slider is modified, Avastar determines the exact Bone Joint matrix for every Bone in the mesh and applies that matrix directly to the mesh and finally resets the Joint matrix to a neutral scale ( 1.0 ). However, we have to take into account that some vertices are controlled by more than one bone. That is where the weight maps come into play again. They simply determine the relative influence of each bone Scale when the influence on a vertex is calculated.

If you do not understand right away what that is, please ignore me here. Or if you are curious about this, then you will want to dive deeper into the principles of Skeletal Animation. Please Google your way to the knowledge in this case. We currently do not have tutorials about this topic.

Why we apply the Scales to the Mesh

Applying the Bone Scales has one remarkable benefit, that is when you reset your Rig to rest pose, you will not loose the current Slider settings because these settings have been stored within the bound Meshes.

And what is the Gotcha please ?

When the weights are modified, then Avastar needs to apply the modified weights to the mesh as well. So modifying the Sliders and modifying the Weights of your mesh both influence the shape of your mesh (also in Rest Pose!) . And because of this any change of your weight maps needs to be propagated to the Mesh as well.

But these calculations are expensive. Because of this we do not propagate changes of the weights immediately to the mesh. Instead of this we provide the Reload Button. So you would do some changes on your weight maps and then hit the Reload shape Button to see how the mesh shape changed. then return back to modify the weights, and hit the Reload button again, and so on …

Note: There is a keyboard shortcut ( ALT +Q )that you can use instead of clicking the Reload Shape Button.

Weightmap Control

The Adjust Weight Groups panel allows you to create initial weights for your Custom Mesh. Weights can come from various weight sources. And each weight source can have different Properties as explained below.

Finally, after all settings have been adjusted, you can generate the appropriate Weights by clicking on the Update Weight Maps Button

Image412

A Gentle reminder

Avastar can not create perfect weights!
Especially when you try to copy weights from other meshes you have to refine the weights manually in almost every case. All that you can achieve is to get a starting point for your work. This may work nicely, or not.
For Fitted Mesh:
If you are trying out the Fitted Mesh Weighting, then we recommend to avoid using the default Avatar weights. Please consider to use Automatic Weight from Bones instead. That gives better results in many cases. Blindly using the weights from the default Avatar never works!

The example below shows 3 identical meshes: The left mesh is weighted to the classic mBones, the right mesh is weighted to the Collision Volumes (cBones) using the same weight values.

sls-4-35

The character in the center gets the full treatment of mBone weights plus mesh deforms (shape keys). This character is equivalent to the default Avatar in SL using the same Gnome shape.

For Fitted Mesh (Collision Volume Bone weighting) you can get much better results when you hand optimize the weights.

Panel Properties

Facemap Generator: This is a very special setup for an interactive face weight generation. Yes, this is only for creating weights for the Bento face bones!

Right after you clicked the Apply Update Weightmaps button, an Operator Redo Window opens up (in the Tool Shelf lower left corner) where you can specify parameters to optimize the weights for the selected bone collection. Please play with the settings to get an idea how the generator works

Image413

Swap Weight Groups: Exchanges Weight Gr0ups for Collision Volumes with the corresponding Weight Groups for the corresponding SL Base Bones (moves mbone Weight Groups to cBones, and cBone Weight Groups to mBones)

  • Keep Groups
  • Clear weights
  • Selected verts

Copy From Extended: We have added Special weightmaps for Head and upper body which take care of the weights for the face and the hands.

Note: Those weight maps have been created manually and they are just meant as proposal for your meshes. You will need to fine adjust the weights in any case!

See below for the description of the extra options .

Image414
Copy From Avastar: Use the Avastar character Meshes as Weight Sources. For this option you can exactly specify which of the Avastar Dummy Meshes shall be taken into account. it does not matter if the Avastar meshes are visible or not.
  • Keep Groups
  • Clear weights
  • Selected verts
  • Interpolate
  • Weights from Avastar (selection table)
Copy From Meshes: Use All meshes which are also attached to the same Avastar Armature and which are currently Visible.
  • Keep Groups
  • Clear weights
  • Selected verts
  • Interpolate
Automatic From Bones: Use Blender’s internal Weight generator by calculating the weights from the Bone configuration. This works remarkably well in most cases. However you often need some minor adjustments especially where the Custom Mesh shall behave similar to the underlying SL Avatar mesh (for tight clothes).
  • Keep Groups
  • Clear weights
  • Selected verts
 Create Empty Groups: Checks all deform Bones for existing Weight Groups. Adds missing Weight Groups as empty Groups where needed.

 No options available

The weight Generator Options in detail

  • Keep Groups: When during the copy process some previously existing weight groups get empty, they will be deleted by default. If this option is set, all empty weight groups will be kept.
  • Clear weights: Normally the weight copy is additive, that is, when Weights already exist in the Target mesh, then weights which are not copied from the source but wexist in the target will be kept. When this option is set, the source weight groups will be cleaned before the copy takes place.
  • Selected verts: Normally the weight Copy copies the entire weight groups. when this option is set, then only weights for the selected verts (in the target meshes) will be replaces or added.
  • Interpolate: Normally weights are copied from the source meshes by determining the closest vertex to the destination mesh. When this option is enabled, then weights are interpolated from neighboring source verts as well. This can give smoother results at times.
  • Weights from Avastar: (Only available when Copy from Avastar is set as weight source) You can specify exactly which Avastar meshes shall contribute in the weight copy.