In our engine, bones exist in form of scene node. We can't tell if a node denotes a bone or not. This sometimes becomes obstacle in animation system.
Why do we need to distinguish bone nodes from normal? I'll list some cases.
Before we start, assume we're processing such a typical hierarchy:
graph TB
Root("Root<br/>{components}: Animation")-->Skin("Skin<br/>{components}: SkeletalMeshRenderer")
Root-->Pelvis("Pelvis π¦΄")
Pelvis-->Spine("Spine π¦΄")
Pelvis-->LeftThigh("LeftThigh π¦΄")
Pelvis-->RightThigh("RightThigh π¦΄")
Pelvis-->PelvisEffect("PelvisEffect β<br/>{components}: ParticleSystem")
Spine-->LeftShoulder("LeftShoulder π¦΄")
LeftShoulder-->LeftUpperArm("LeftUpperArm π¦΄")
LeftUpperArm-->LeftLowerArm("LeftLowerArm π¦΄")
LeftLowerArm-->LeftHand("LeftHand π¦΄<br/>{components}: β ParticleSystem")
LeftHand-->LeftIndexFinger("LeftIndexFinger π¦΄")
LeftHand-->Sword("Sword β<br/>{components}: ParticleSystem")
LeftThigh-->LeftUpperLeg("LeftUpperLeg π¦΄")
style PelvisEffect stroke-width:2px,stroke-dasharray: 5 5
style Sword stroke-width:2px,stroke-dasharray: 5 5
In which:
-
This portion of scene hierarchy is instantiated from a model prefab imported from external model file(glTF, FBX).
-
Nodes may have a special
<components>:
child line indicates its components. -
Root is the instantiated prefab root. Animation component or animation controller component is attached to root node.
-
Nodes suffixed with a 𦴠means this node participates in skinng process.
-
Nodes or components suffixed with a β means this node or component is later-added as a prefab overrides. These usually are attachments that user want to have the attachment follow the transform of bone.
Suppose we're going to blend TRS animations on above hierarchy, we need to sort out which nodes partipates in animating and blending.
First, all bone nodes should participate in animating and blending. Other nodes, in theory, might also be animated but in practicle users don't need these node to be animated.
Given that we don't know the boundary of bone node and normal node, animation on bone node is implemented as normal node TRS animation. Under this assumption, we can not construct a effective buffer to blend poses.
In skinning process, vertices are affected by bones. There might be the essential defininition of bone. Follow this thread, we