We define a new node called Skin
(Pascal: TSkinNode
). It allows to design a skinned animation (using skeleton with joints, and shapes with skin weights).
It has the following properties (click on each property for more detailed API docs):
-
joints
When the joints are transformed (moved, rotated, scaled), the skin (meshes listed in Skin.shapes
) is updated accordingly.
-
inverseBindMatrices
For each joint, an "inverse bind matrix" may be specified, which transforms the mesh into the local space of the joint.
Allowed values: list of 4x4 matrices.
-
shapes
Shapes whose geometries are affected by the skinned animation, that is: their vertexes move to follow the joints that are associated with them.
-
skeleton
Common root of the joints hierarchy.
This node defines how a set of joints influence a mesh, thus enabling skinned animation in a way that is simple, efficient and perfectly aligned with glTF. This node directly corresponds to a single glTF skin in a glTF file.
The idea is that you have:
-
A skeleton, which is a hierarchy of joints (aka "bones"), expressed in X3D as a hierarchy of TTransformNode
(or any other X3D node that defines transformation, like THAnimJointNode
).
-
A number of meshes, which are a number of X3D geometry nodes using TAbstractCoordinateNode
with per-vertex data in SkinWeights0
and SkinJoints0
.
Each vertex of a mesh is affected by a small subset of joints. For each joint on each vertex, a weight determines how much each joint affects this vertex. You can change joints (change their transformations, e.g. by regular X3D animation using TTimeSensorNode
and interpolators, or just directly access the joint node from Pascal and change its translation / rotation / scale) and in effect the mesh should change.
The Skin
node defines the connection between the joints and the skin.
Placement of the Skin
node within the X3D nodes graph matters. Skin
is a descendant of the X3DChildNode
(TAbstractChildNode
) in Pascal) node. Placing it under a specific parent transformation makes the resulting joints (Skin.joints
) and skin (Skin.shapes
) be part of the X3D transformation hierarchy, so they are rendered with the designated transformation.
Note
|
The Skin node itself is not an "animation" that you can play. The actual animations are defined by using TimeSensor nodes that cause interpolators to transform (move, rotate, scale) the joint nodes. Animating joints will in turn transform the meshes as indicated by this Skin node.
|
Note
|
There are some differences, but there are also some similarities between Skin node and HAnimHumanoid node. They both can be used for skinned animation. If you’re familiar with H-Anim and HAnimHumanoid node, we outline the differences (and similarities) in the section below.
|