Difference between revisions of "Dev:Bones"
(First draft) |
(→Basic concepts: Remove indentation) |
||
Line 40: | Line 40: | ||
This magic calculations are preformed by converting a point (vertex or blinepoint) into a BoneInfluence Value Node Convert type. The conversion offers the following sub parameters: | This magic calculations are preformed by converting a point (vertex or blinepoint) into a BoneInfluence Value Node Convert type. The conversion offers the following sub parameters: | ||
Point Bone Influence: | Point Bone Influence: | ||
− | + | * Point link: This is the point setup position | |
− | + | * BoneWeight Pair List: This is a list of BoneWeight Pair value node type | |
− | + | ** BoneWeight Pair: This is a entry sample of BoneWeight Pair value node type | |
− | + | *** Bone Id: This is the ID of a bone | |
− | + | *** weight: this is the weight of this bone over the point. | |
− | + | ||
==Appendix: How does bones feature work?== | ==Appendix: How does bones feature work?== | ||
This is a description of the internal of how does bones work (write link here). It is not necessary to understand/read this part to understand the usage of the bones from the point of view of the user interaction. | This is a description of the internal of how does bones work (write link here). It is not necessary to understand/read this part to understand the usage of the bones from the point of view of the user interaction. |
Revision as of 18:24, 2 November 2010
Introduction
One of the most wanted features for a 2D animation software is the bones feature. The original developer didn't implement bones in Synfig because it could become a restriction to the freedom of the animator to give expression to the creation. Finally, the decision of include the bones feature was taken and a core bones implementation is already available in the Synfig code.
Bones feature has two main parts. The core of the bones feature and the graphical user interface of the bones feature. At the time of writing this article, only the core of the bone feature is implemented with a very primitive user interface.
This article will introduce you in the knowledge of how are currently the bones feature implemented and how should it continue its development. Once finished the bones development, this pages should be moved to the talk page and the Dev namespace should be removed from the article to turn it into a regular documentation page.
The firsts seeds of the bones development are the notations in the Bone Layer. At first stage the idea of a Bone layer was around because most of the features of Synfig are applied in the form of layer on a stack. During the bones development we realized that the concept of bone layer is not strictly needed. Currently it is possible to not have any Skeleton layer (this is how it is called in the Bone Layer page) and the bones can be working on a Synfig document.
Basic concepts
Bones affect points (blinepoints or individual vertexes). This means that when a bone is modified it can affect to points that are under its influence. Bones have:
- Origin
- Angle
- Local Width Scale
- Local Length Scale
- Recursive Width Scale
- Recursive Length Scale
- Setup Origin
- Setup Angle
- Setup Length
Although they can look to be a lot of parameters, we can concentrate only on some of them: origin, angle, length/width (we will talk later about the recursive ones). Let's see how do those parameters affect to a point that is under the influence of a bone:
- When a bone modifies its angle, the point rotates around the origin.
- When a bone modifies its origin, the point translates the same amount than the bone's origin.
- When a bone modifies its length or width, the point scales in the length or width direction of the bone.
All the above point modifications under bone influence needs some other information to allow know the exact position of the point after the influence. For example, when the bone rotates, the distance of the point to the bone's origin is very important, because it determines the rotation radius. So, there must be a "setup" position of the point relative to the bone where the calculations are made from. Following that reasoning, the bone should have two sets of values, the setup values (also you can call them the "rest" values) and the animated values. And so, the points should have a setup values and a calculated values when the bone influence is applied.
Those two set of values (setup and animated or calculated) are representation of the same object in two states, the setup state and the animated state.
Apart of the single bone -> point influence it is possible that a point were influenced more than one bone. If only one bone could affect to a point, then we would be talking of cutout animation. But bones are much more than cutout. The points can be influenced by more than one bone at a time. To solve this problem we implemented the concept of weighted influence. A point is influenced by a the pair of the bone an its weight so each single bone influence is multiplied by its weight and then added to all the other weighted bones and finally divided by the sum of weights. This is known as linear combination of bones.
So the thing works like this: To calculate the bone influenced animated position of a point, it is taken its setup value and applying the setup values of the bones and the animated values of the bones, a new point position is calculated. This is performed for each bone and linearly combined with the bones weights.
This magic calculations are preformed by converting a point (vertex or blinepoint) into a BoneInfluence Value Node Convert type. The conversion offers the following sub parameters: Point Bone Influence:
- Point link: This is the point setup position
- BoneWeight Pair List: This is a list of BoneWeight Pair value node type
- BoneWeight Pair: This is a entry sample of BoneWeight Pair value node type
- Bone Id: This is the ID of a bone
- weight: this is the weight of this bone over the point.
- BoneWeight Pair: This is a entry sample of BoneWeight Pair value node type
Appendix: How does bones feature work?
This is a description of the internal of how does bones work (write link here). It is not necessary to understand/read this part to understand the usage of the bones from the point of view of the user interaction.