This page describes elements that define models to be skinned. This description assumes an understanding of Defining Model Shapes and Vertex Attribute Data. For information on animation files (.cska) applied to skinning models, see the page on animation files.
The hierarchical structure of bones that control skinning is called a skeleton. (It also typically called a rig. ) Skeletons consist of multiple bones. Each bone defines a hierarchical structure by specifying its own parent bone. In addition to defining a hierarchical structure, skeletons also define a default pose. This default pose is called a bind pose. The bind pose defines how the skeleton was posed for the model shape before skinning deform. When using skinning, the way in which the model is deformed by a skeleton animation is calculated based on the relative positional relationship between bones and vertices while in the bind pose.
Skeleton and Bind Pose
The <Bone> element is used to define a single bone. This element includes the bone name, parent bone, bind pose, and flags for scaling, making calculations and so on.
The <Skeleton> element appears inside the <SkeletalModel> element only once. It indicates the start of the definition of <Bone> elements. (There is a <Bones> element between these tags, but this element does not have any particular function. ) Multiple <Bone> elements are enumerated in the same XML hierarchy.
<NintendoWareIntermediateFile> |
Bones and nodes created with a DCC tool are defined in the <Skeleton> element, but sometimes only some of the bones referenced by each skinning model are included. For example, if the torso and head are created as separate models, skinning the head will affect the neck and eye bones, but will not affect arm and leg bones. In this way, only the bones required for skinning each model are defined. An array of such conversion matrices is called a matrix palette. In this example, a matrix palette for the torso and another for the head can be defined. In the intermediate format, a matrix palette is defined for each primitive (<PrimitiveSetCtr>) making up a shape.
Assigning Bones to Matrix Palettes
The <BoneIndexTable> element appears only once in the <PrimitiveSetCtr> element. It defines a matrix palette using an index to specify <Bone> elements inside the <Skeleton> element.
<NintendoWareIntermediateFile> |
There is a limit on the number of matrices that can be loaded in the shader register when performing skinning using a vertex shader. This also results in a restriction on the matrix palette size as well. If the number of bones that influence a single shape exceeds this limit, you can handle it by dividing the primitive into multiple subdivisions. (A shape <SeparateDataShapeCtr> can inlcude more than one primitive (PrimitiveSetCtr).)
Skinning mode settings are defined by the SkinningMode attribute in the <PrimitiveSetCtr> element. SmoothSkinning enables skinning, RigidSkinning results in rigid skinning, and None disables skinning. In addition, vertex attribute data vertex coordinates, normal vector, and the tangent coordinate system differ depending on the skinning mode.
Vertex attribute data is maintained by the shape defined by <SeparateDataShapeCtr> higher in the hierarchy than the primitive <PrimitiveSetCtr>. The coordinate system for vertex attribute data is therefore determined at the shape level. Accordingly, the skinning modes specified between primitives inside a shape must all be the same.
In the skinning process, each vertex has a bone that influences it and an associated weight. Bones that influence a vertex are defined in vertex attribute data using the BoneIndex attribute. The weight is defined by the BoneWeight attribute. Each vertex can be influenced by up to four bones.
The BoneIndex attribute specifies bones using an index inside the matrix palette. Skeleton bones are referenced from the bone index defined for the vertex attribute in two stages: Vertex attribute > Matrix palette > Skeleton bone array. The BoneWeight attribute defines the influence of each bone on a vertex as a percent.
Vertex data is referenced by <IndexStream> in the <PrimitiveSetCtr> element. The BoneIndex attribute references the <BoneIndexTable> inside the <PrimitiveSetCtr> element that references that vertex data.
<SeparateDataShapeCtr> |