Categories: Uncategorized

How to get started with Skeleton and Mesh Skinning Conversions.

For several decades, Okino has been a pioneer in creating 3D configurators, actively researching and developing professional skeleton and skinning conversions between the most popular 3D character animation software packages and file formats such as 3ds Max, Cinema 4D, LightWave, Maya, Softimage, Collada, DirectX, FBX and U3D. In the following article we would like to give you an overview of the concepts behind Skeleton, Skinning and explain why conversions of skinning data between the above mentioned software packages are generally very advanced with potential problems.

Based on Okino’s direct customer experience, long and focused development and feedback given to animation companies to correct mistakes and problems in a mesh skin code, Okino can rightly claim that they currently offer the best, most sophisticated and technically advanced skinning conversion systems on the market. This is especially true if you need to convert skeletons and skinned meshes between 3ds Max (Physique or SkinMod), Cinema 4D, LightWave, Softimage and Maya. These five programs are not particularly compatible due to bone re alignment differences, biped off-axis scaling issues, and Maya’s “missing” binding positions. Our skinning system is also known for being able to repair incorrectly converted skeletons and skinned mesh conversions created from other free and paid programs: All you have to do is export to the Okino.bdf file format of 3ds Max or Maya and then re-import the file – the Okino “Arctic” toolkit compensates for inherent problems in the conversion process.

Since the concept of mesh skinning is quite simple, Okino believed that the conversions of skeleton and skinning data would be an easy matter to develop, but this was not the case. All sorts of problems can occur when converting such data (which other converters didn’t seem to handle), like for example:

  • Replication of skewing or off axis data in a 3ds Max hierarchy that downscales the skeleton tree before exporting (a classic problem with 3ds Max hierarchies),
  • Realignment of Maya “Joints” for use in 3ds Max as bones by combining and resampling the animation curves on the skeleton nodes (this unique Okino processing option in Okino’s 3ds Max plugins can even be used to fix bad conversions of other converters),
  • Conversion between the less common method of having skeletons under a mesh (as used by LightWave) and the more typical method of having skeletons and meshes separated from each other.
  • Convert implicit skin weight formulas (as in LightWave) to explicit skin weight values as used by all associated 3D file formats.
  • Or even calculating “healthy” sizes and orientations of Mayan joint skeletons that merge into 3ds Max Node-based skeletons.

For DirectX, Okino has had the industry accepted .X standard export implementation since 1997. The .X file format only changed with DirectX 8.1, which added support for real-time mesh deformation using smooth skinning techniques and vertex duplication lists. Okino has expanded its .X importer and exporter to process mesh skinning and vertex duplication lists as well as import the new data representation “matrix animation”. As we have learned in the past, the simplest file formats cause the most difficulties in development and this is directly applicable to the .X file converters to allow the carefree export of skinned meshes, the ability to output the mesh data after skeleton output has been added (for cases where a mesh could be within a skeleton hierarchy) and automatically generate additional dummy nodes if the peak weights do not add up to 1.0 on a mesh (DirectX does not like this case).

What are Skeletons?

Skeletons in a 3D character animation have a direct relationship to a human skeleton. They consist of articulated bones and joints and can be used as a control mechanism to deform attached mesh data by skinning. The skeleton actually consists only of “null nodes” in 3D space (or “dummy nodes” or “grouping nodes”, as they are often called). The parenting of the null nodes together creates an explicit hierarchy and the transformations on the null nodes define the rotation and offset of each null node from its parent null node. The position of each null node corresponds to a “joint” and the distance between two subordinate null nodes defines the length of the bone.

Some 3D programs are “hinge-based” and others are “bone-based”. Maya and Okino`s PolyTrans are “joint-based”, which means that the bone is implicitly visualized between two joint nodes (two null nodes). You always need at least two joints to define a bone. Other programs, like 3ds Max and LightWave, are “bone-based”, i.e. a bone is visualized based on a starting position, direction and bone length (a child joint node is not necessary in these programs to make a bone visible).

Within Okino’s stand-alone software (PolyTrans and NuGraf), the skeletons are visualized as a sphere centered on each joint, with a trapezoidal bone connecting the spheres.

Skinning: Mesh deformation due to smooth/rigid binding of bones and skeletons.

“Skinning” is a popular method for real-time deformation of polygon meshes using the bones/joints of a structured skeleton. “Skinning is the process of binding a skeleton to a single mesh object and skinning deformation is the process of deforming the mesh when the skeleton is animated or moved. When the skeleton of bones is moved/animated, a matrix association with the vertices of the mesh causes them to deform weighted. Skinning is a popular method to deform characters and objects in many 3D games.

Okino’s PolyTrans and NuGraf software have a nice implementation of mesh deformation over weighted connections, or in other words “smooth skinning”. It was created as a pipeline for importing, saving, playing, querying, optimizing and re-exporting scanned data between the main character animation file formats and animation packages.

Basic concepts of skinning.

Skinning works on the principle of moving one or more “deformed” gizmos, which in turn are weighted at certain vertices of a mesho object to pull it to deform it locally. It is common for a single bone to have several deformer objects associated with it, each of which has a share of the total deforming “strength”, but all of which together have a strength of 1.0.

The traditional character animation system uses a single main braid object (i.e. an entire human body consisting of a braid object) and a skeleton. The skeleton is simply defined as a hierarchy of null nodes. In some animation systems, the skeletal null nodes are visualized as bones (3ds Max, Cinema 4D, LightWave) that have a source position and direction, while in other animation systems they are visualized as connected joints + bones (Maya, Okino) that are simple spheres connecting a skeletal bone center to the nearest skeletal bone center. The skeleton acts as a deformer for the mesho object that is the deformity.

Skinning in an authoring package is done by selecting a bone / connection and assigning it as a deformer to one or more corner points of a mesh object. A weight value is assigned to this node/bone assignment. A value of 0.0 means that no tugging is performed, while a value of 1.0 allows the bone to fully tug at the vertex. In many cases, multiple bones will be assigned to a single node (so that multiple parts of the skeleton manipulate localized areas of the mesh), in which case all weights assigned to a single bone must be “normalized” and add to 1.0. Furthermore, as an integral step, when the skeleton becomes bound to the meshobject for the first time, a series of “Bind Pose” matrix snapshots are taken defining where the meshobject was and where the skeletal connections were at the time of the binding in World Space. These “bond position” matrices represent a kind of static, fixed coordinate system with which the skinning rendering algorithm can detect whether a skeleton has been animated/transformed and thus use the differently calculated changes in skeleton positions to equally transform the bones of the bonded mesho object, which is the purest definition of skinning.

If there is one bone per vertex and the weight is 1.0, this is often referred to as rigid skinning, but if there are multiple bones per vertex and the weight is not 1, it is called smooth skinning.

Skinning is the process of binding a skeletal hierarchy to a single mesh object. This is done by assigning one or more influencing joints (e.g. bones) to each node of the mesh, each with an associated weighting value. The weight value defines how much a certain bone influences the vertex in the deformation process. Note: In general, a mesh can be influenced by any other object in the scene as a deformer and not just by null nodes marked as skeletal connections. Basically, any instance, any null node instance, or any instance marked as a link can be used to deform a mesh object (only the null node transformation matrix is needed for the deformation process).

When the mesh is first bound to the skeleton, a Bind Pose WorldSpace snapshot of all transformation matrices of the mesh and skeleton nodes is created. These binding position matrices allow you to transform any node position into the local coordinate space of the associated influencing bone at the time when the mesh and skeleton were in their original undeformed position (the “binding position,” “rest position,” or “reference position”). During real-time playback, any movement of the skeleton away from its “binding position” results in a corresponding deformation of the mesh.

The binding position.

If a skeleton and a mesh were imported and bound together with skinning weights, then most likely the binding position matrices were also defined and adjusted. These matrices define the world space position of the mesh object and the associated skeleton bones/joints at the time of binding. Normally, in the PolyTrans/NuGraf user interface, you will see the mesh deforming under the influence of the current skeleton position (unless skinning is globally disabled). If you want to return the skeleton and mesh to their poses without deformation at the time of the first binding, you must use Go to Bind Pose on the mesh instance and each bone/joint instance.

The “Binding Position” Explanation.

The “Binding Position” is often the most confusing aspect of learning to program the Skinning API, but the absolutely most important concept to understand. The “binding position” is the position of the mesh object, the skeleton, and their relative offsets at the moment the skeleton is bound to the mesh object and before deformations occur. This pose often looks like this:

  • Arms outstretched,
  • Shoulders lying at the same height
  • and the skeleton is aligned with the limbs of the mesho object.

At the moment the skeletal bones are bound to the mesh (via the Bones-Vertex assignments with corresponding weight values), a snapshot matrix called “(WorldSpace) Bing Pose Matrix” is created for each bone/joint and the mesh itself (not to be confused with the local transformation matrix). These are very important matrices for skinning. The bond position matrices are stored in the instance definitions that define the mesh object and the skeleton/bones/joints (bone/joints in the NuGraf Toolkit are only null nodes or empty instances, as they are often called). The Bind Pose matrices define the original Worldspace position of the mesh and bones/joints at the time of binding.

How are binding position matrices used during skinning deformation? This is the key point to understand: the matrices allow a raw vertex of the mesh (in local coordinates) to be transformed into World Space and then into the local coordinate space of each bone, after which the animation of each bone can be applied to that vertex (under the influence of the weighting value). The binding position of the mesh takes the vertex from local space to World Space and then the inverse binding position of each bone takes the vertex of the mesh from World Space to the local space of that bone. Once in the local space of the bone, the current animated transformation matrix of the bone is used to transform (deform) the position of the vertex. After all bone influences have been taken into account, the node lands in World Space at its final deformed location. In other words, these binding position matrices relate the position of a node in its local mesh space to the same position of the node with respect to the local coordinate systems of the individual bones. Once this relationship is known, it is easy to deform the meshnodes by animating the bones.

All you need to note is that the Bind Pose Matrix of the mesh brings its nodes into World Space, to the location at the time of binding and the Bind Pose Matrix of each bone brings the nodes from local space into World Space at the time of binding.

Thank you for visiting.

3DMaster