The Bone Component is the foundation of all of the Character Tools. It is a Component with most of the properties of a Geometry Component. It also has some extra features such as length, two types of geometry, end-to-end linking, and kinematic parameters.
Bone Geometry - By default, Bone Components contain two types of geometry: link geometry and capture geometry. Both of these are defined in the Bone Component's network of SOPs and are therefore customisable. In most cases, the defaults are sufficient.
The link geometry consists of a narrow diamond shape with one corner at the origin of the Bone Component. The opposite corner is stretched down the Bone Component's negative z-axis in accordance with the value in the Bone Component's length parameter. This link geometry is used to simply give a visual indication of the position and size of the Bone Component.
The capture geometry defines a capture region that can be used to apply skeletal deformation to some other geometry. It consists of two ellipses that are positioned along the length of the Bone Component. There are several parameters in the Bone Component that can be used to adjust the size and position of each of these ellipses. If a Bone Component is a direct descendant of another Bone Component, then its capture geometry will also contain a user-defined number of ellipses connecting the first ellipse of the child to the second ellipse of the parent. These ellipses provide extra control over skeletal deformation of the "joints" of a character.
The link geometry and capture geometry have separate parameters controlling whether they are displayed. Usually, the link geometry is displayed while doing the positioning of the bones, and the capture regions are displayed when defining the capture regions used for skeletal deformation. When the character has been set up fully, then both display parameters can be turned off.
The construction of both types of geometry in the Bone Component's SOP network is fairly straightforward and worth investigating.
The link geometry consists of two pyramid shaped meshes positioned base to base, and stretched with a Transform SOP which references the Bone Component's length parameter. The result is then fed into a Switch SOP that will switch between the link geometry and nothing, depending on the value of the Bone Component's Display Link parameter.
The capture geometry is created using two Circle SOPs that reference the appropriate parameters in the Bone Component to determine their size and orientation. Their size depends on both the Ellipse 1 & 2 Radius and Length parameters of the Bone Component. This is so that the default capture regions will be reasonably sized for commonly used bones. The Length dependence can be easily removed by modifying the expressions in each circle's Radius parameter.
The joint of the capture geometry is created using a Joint SOP which was created for this specific task. It creates intermediate ellipses between the last ellipse of the parent Bone Component (which is imported using the Object Merge SOP called
parent_end), and the first ellipse in the current Bone Component (
Note: In order for the Joint SOP to function correctly, the parameters of parent_end must be set manually by the user, unless the bone-creation state was used to create the bone.
The output of the Joint SOP is combined with
circle2 to define the capture geometry of the Bone Component. This geometry is fed into another Switch SOP which controls the display of the geometry in a fashion similar to the Switch SOP used for the link geometry.
There is an Add SOP called
point which outputs a single point. This SOP is used as the replacement for the link and the capture geometries when they are not being displayed. It is also used as the Bone Component's visible geometry, as its display flag is set.
End to end positioning - By default, there is an expression in the Bone Component's Transform parameter that will do one of the following:
- If the bone has no parent, then its origin is locked at the world origin.
- If its parent is a Bone Component, then it is locked at the end of the parent bone.
- It it has some other parent, then it is locked at that parent's origin.
The second case above is referred to as the end to end positioning of bones. It is the most often desired behaviour.
To override this behaviour, edit the expressions in the bone's Transform parameter or simply delete the channels containing the expressions (right click on parameter, then select Delete Channels). If you wish to retrieve the expressions after they've been modified, load the file
$HS/presets/bone/end_to_end.preset using the Load command from the Presets menu in the parameter dialog.
Bone Parameters - Bone parameters are discussed in Bone Component.
It should be noted that some of the common transform parameters (scale, pivot, transform order and rotate order) do not appear in the Bone Component's parameter list, however, they do exist and can be changed using the channel editor or keyboard commands. Bone positioning and kinematics will only function correctly if these values are unchanged. Here are the parameters and their correct values:
Scale: 1, 1, 1 Pivot: 0, 0, 0 Transform Order: Scale Rot Trans Rotate Order: Rz Ry Rx
Creation of Bones - While bones can be created one by one, we highly recommended that the Bone Creation State be used (see Bone Creation State in the TouchDesigner Interface Guide). The Bone Creation State greatly simplifies the process of creating bones. It sets up Null Components at the base of bones when necessary so that the kinematic solutions will behave better.
Any linear hierarchy of Bone Components can be organized into a Bone Chain. The first bone in this hierarchy is called the Driver of the Bone Chain, and contains a reference to the last Bone Component in the chain.
Once a Bone Chain is defined, it can be associated with a Kinematic Solver that will determine the orientation of each Bone Component in the Bone Chain. For example, you could use a Follow Curve Kinematic Solver which would align the bones in the Bone Chain along a given curve. This and other Kinematic solvers are discussed in the Kinematic Solvers below.
The inputs to all Kinematic Solvers are the length of each Bone Component in the Bone Chain, and its orientation when "at rest". Each Kinematic Solver may also require other solver-specific parameters. The Follow Curve Solver, for example, requires the curve along which the Bone Chain should be aligned. From its inputs, each Kinematic Solver computes the appropriate orientation of the bone chain, and returns that as output.
The rest angles of a chain are generally used to specify the initial orientation of the chain from which the solution is derived. The rest angle for each bone in the Bone Chain is contained in the Bone page in that bone's parameters. The extra solver-specific parameter is specified in the same Bone page, but only in the Driver of the Bone Chain.
Whenever the Driver cooks, it collects all the rest angles from each of the bones in the Bone Chain, and passes them, along with any solver-specific parameters, to the appropriate Kinematic Solver. It then takes the output from the solver and sets the rotation parameters of each bone in the bone chain appropriately.
Note that because the Driver is setting each bone's rotation parameter, the rotation parameters shouldn't be animated by the user. They will always be over-written by the values given by the Kinematic Solver.
Introduction - There are four types of kinematic solvers in TouchDesigner. Kinematic Solvers are responsible for determining the orientation of bone chains. Each will orient a given bone chain according to the algorithm it uses and its given parameters.
- Inverse Kinematics
- Follow Curve Kinematics
- Show Rest Position
- Show Capture Position
The first two solvers are used to control bone chains for animations, while the last two are used as "helper" utility tools.
Each of these solvers will be discussed in this section. In addition, a method of bone chain control called Forward Kinematics will be covered.
Inverse Kinematics - In Inverse Kinematics, we specify the desired location of the end of a bone chain and the solver will subsequently determine the corresponding set of joint angles within the bone chain. The desired location of the bone chain is specified using the origin of a Component. The IK solver tries to bend the bone chain so that its end touches the origin of the Component. This Component is referred to as the end-affector of the chain. The start of the bone chain (the location of the start of the first bone) is called the base of the chain.
TouchDesigner's IK solver produces unique solutions. That is, for a given end-affector position, the same solution is always found regardless of the direction of movement of the end affector. Secondly, the shape of the IK solution can be changed interactively by changing the rest angles of the bone chain. Thirdly, TouchDesigner's IK is prismatic, which means that you can animate the bone lengths within a bone chain and the IK solver will continue to solve for the end-affector position. Finally, TouchDesigner's IK can work with planar IK chains (2D) and non-planar IK chains (3D).
How Does TouchDesigner Determine Inverse Kinematics Solutions? - Consider the following situation: An IK chain is fully extended (all of its bones are in a straight line) and the end affector is then moved closer the to base of the chain. The joints in the chain must bend to allow the end-affector to move in. The question is, "How does TouchDesigner decide which way to rotate the joints in this situation?" The answer is that you specify the preferred direction of rotation by using the Rest Angles of the bones.
Rest Angles - Simply put, each joint in an IK chain will rotate toward the Rest Angle. Thus, in the figure below, if a chain has the rest angles shown in dashed lines (Rest), the chain will move toward the configuration shown in bold lines (I.K. Solution) when compressed from full extension.
Adjusting the rest angles gives you an interactive method of choosing among the many possible joint orientations which will satisfy a given end affector position. In addition, the rest angles also specify the relative amount that each bone will rotate when the end affector is moved. In this sense, the rest angle can be thought of as a "relative weighting" for each local joint rotation.
That is, in the following illustration, since the rest angle Qrest is more acute than the rest angle Frest, the corresponding joint will rotate more when the end-affector is moved. Note however that the IK solver will give preference to sharper angles only to a certain point, after which it will have no choice but to rotate the shallower angle.
Planar vs. Non-planar IK - In Planar IK, all of the joints act as hinges. A planar IK chain is created by placing non-zero rest angles only in X or in Y. If the rest angles are in more than one dimension or about different dimensions for different bones, the resulting chain will be non-planar. In this case, each joint will act as a ball joint instead of a hinge.
Planar IK is faster and usually more manageable than non-planar IK. Often a non-planar limb can be divided into sets of planar IK chains. In TouchDesigner IK, a ball-joint is inherently placed at the start of every IK chain. Thus, you can usually achieve the effect of a non-planar IK chain with two or more planar IK chains, placing the start of the second IK chain at the location when a ball joint would occur in the character.
picture of legs, two ball joints, planar IK...
Additional Controls for IKedit
The Bone Length - This parameter controls the length of the bone segment and can be animated. As the bone length changes, the IK solver will adjust the internal joint angles so that the end of the chain remains stuck to the end-affector. Note however that if you have channels set for the bone length and you change the bone length, the IK solver will not cook until a keyframe, or timemark, is set (the red keyframe indicator is changed from red to green).
The Twist - This parameter specifies a rotation about the axis which runs from the base of the bone chain to the end-affector. It is very useful for controlling the twisting of the ball joint in at the top of the chain.
Follow Curve Kinematics - TouchDesigner's Follow Curve kinematics provides a method of controlling bone chains with many segments, such as in spines or tails.
Follow Curve kinematics requires a piece of curve geometry to follow (the Curve Object parameter). This curve can be of any type (NURBS, Bezier or Polygon). Follow Curve will adjust the joint angles within a chain so that the bone chain follows the shape of the curve. If the curve is too far from the bone (that is, the bone cannot physically reach the curve), the joint angles of that bone are adjusted so that the distance between the end of the bone and the curve is minimised.
A follow-curve chain with curve away from the first two chain bone
Show Rest Position - This kinematic solver will look up the bone angles in the Rest Position parameter of each bone and use these angles to rotate each bone. This solver is useful if you wish to view the orientation of your bones when they are in the rest position.
Show Capture Position - This kinematic solver is similar to Show Rest Position except that it uses the angles in the Capture Angles parameter to determine the orientation of each bone.
The capture angles of the Bone Component store the orientation of the bone when the bone was last used for capturing points in the Skeleton SOP. The Show Capture Position solver can be used to position the bone chain as it was at the time of the capture so that capture regions can be adjusted.
Forward Kinematics Control - In Forward Kinematics, we specify the rotations of each bone and thus we inherently move the end of the skeleton to some place in space. In this sense, Forward Kinematics is not really a kinematic solver.
There are two ways you can control forward kinematics in TouchDesigner. The first is to create a bone chain hierarchy and simply change the angles in the Transform Tab of each Bone Component. Keep in mind that Bone Components are still TouchDesigner Components and can thus be parented and transformed in the same way that geometry, cameras and lights are.
A second method of control for Forward kinematics is creating a hierarchy of single-bone inverse kinematic chains. The end-affectors for each single-bone IK chain can then be used to directly manipulate the joint rotations in the view-port.
A forward kinematic chain with affectors and hierarchy.
This type of Forward kinematics using affectors is set up automatically when you create a Forward Kinematics chain using the Bone state. For more, see Bone Creation State in the TouchDesigner Interface Guide.
Bone Creation Stateedit
The Bone Creation state is one of TouchDesigner's Character Tools. It enables you to interactively create bone chains by drawing in a Viewport. Some special features of the Bone Creation state include:
- The creation of capture regions, Bone Components, and end affectors automatically.
- Easy parenting of a new bone chain to other geometry.
- Control over the naming of new geometry.
- The replacement of standard bone geometry with user geometry.
- Explicit numeric specification of bone positions.
- Avoidance of non-planar IK chains when possible.
For a complete description of the Bone Creation state, see Bone Creation State in the TouchDesigner Interface Guide.
Deforming Geometry with Bonesedit
TouchDesigner has three SOPs which define the way geometry is deformed by bones. This addresses the problem of assigning point deformation weights (termed "weighting" by some other packages). This provides the most procedural, intuitive and flexible way to weight a character and deform it.
Capture Region SOP - The Capture Region SOP defines a volume (a tube with a hemisphere at each end). Points which are inside this Capture Region will be deformed as the Capture Region moves.
Capture SOP - The Capture SOP assigns point capture weights to geometry. The point capture weights are stored as point attributes with the geometry. The Capture SOP does not change the look of your geometry, it simply prepares it to be deformed by the Deform SOP.
Deform SOP - The Deform SOP actually deforms you geometry (as the name implies) based on the point capture attributes in the geometry. The weighting and deformation of geometry were separated into two SOPs to give you the flexibility of procedurally modifying the geometry and/or weighting between these two operations.