User Tools

Site Tools


gamedev:animators

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gamedev:animators [2012/11/30 15:43] dragonlordgamedev:animators [2024/04/01 15:46] (current) – [Rule] dragonlord
Line 1: Line 1:
 +{{tag>animator animation}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[gamedev:main|Game Development with the Drag[en]gine]] >> **Animators and Animation**+[[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> **Animators and Animation**
 </WRAP> </WRAP>
  
Line 6: Line 7:
 Animations are a central point in any game as they give life to 3D models. When it comes down to animation systems there exists in general three types: animation sequence, parametric animation and procedural animation. Furthermore animations can be classified as static or dynamic. The animator system combines all three types of animations providing a rich set of possibilities to create all kinds of animations. The following list describes briefly the three animation types. Animations are a central point in any game as they give life to 3D models. When it comes down to animation systems there exists in general three types: animation sequence, parametric animation and procedural animation. Furthermore animations can be classified as static or dynamic. The animator system combines all three types of animations providing a rich set of possibilities to create all kinds of animations. The following list describes briefly the three animation types.
  
-**Animation Sequence**\\+===== Animation Sequence =====
 The animation sequence is used often for titles where complex animations are not required. There an animation sequence created by an animator is simply played back. This is the most simple form of animation requiring the least processing power. Depending on the game type animation sequences can work well. The Drag[en]gine provides support for animation sequences using the //Animation// resource type. Animation resources store a list of moves which contain each one specific animation sequence. Moves store the animation sequence for a set of bones. These bones are matched on run-time against the bones of an actual 3d model rig whereas non-matching ones are ignored. Animation sequences are therefore a static animation type. The animation sequence is used often for titles where complex animations are not required. There an animation sequence created by an animator is simply played back. This is the most simple form of animation requiring the least processing power. Depending on the game type animation sequences can work well. The Drag[en]gine provides support for animation sequences using the //Animation// resource type. Animation resources store a list of moves which contain each one specific animation sequence. Moves store the animation sequence for a set of bones. These bones are matched on run-time against the bones of an actual 3d model rig whereas non-matching ones are ignored. Animation sequences are therefore a static animation type.
  
-**Parametric Animation**\\ +===== Parametric Animation ===== 
-The parametric animation is a step up from the simple animation sequence in that multiple animation sequences are blended together to create a dynamic animation. The blend weights determine how much influence one animation sequence has on the final result. This animation type is the de-facto standard for triple A game engines looking for complex and highly dynamic animations. Usually these systems are accompanied by a pre-processing engine which determines transition points between the individual animation sequences. These systems can become quickly very complicate to work with since you need all kinds of animation sequences for the possible variations on the animation a player can provoke. Usually this system is used together with motion capturing since creating all the animations from hand can require some time ( often needed though... you can't mo-cap a dragon for example ). Parametric animations provide in general good animation results especially with large animation sets. This is though also the problem that you need many animation sequence variations to build believable dynamic animations. You can not simply create a new pose without modifying large parts of the animation set.+The parametric animation is a step up from the simple animation sequence in that multiple animation sequences are blended together to create a dynamic animation. The blend weights determine how much influence one animation sequence has on the final result. This animation type is the de-facto standard for triple A game engines looking for complex and highly dynamic animations. Usually these systems are accompanied by a pre-processing engine which determines transition points between the individual animation sequences. These systems can become quickly very complicate to work with since you need all kinds of animation sequences for the possible variations on the animation a player can provoke. Usually this system is used together with motion capturing since creating all the animations from hand can require some time (often needed though... you can't mo-cap a dragon for example). Parametric animations provide in general good animation results especially with large animation sets. This is though also the problem that you need many animation sequence variations to build believable dynamic animations. You can not simply create a new pose without modifying large parts of the animation set
 + 
 +===== Procedural Animation ===== 
 +Procedural animations are the most dynamic type of animations often not requiring animation sequences at all. Here movie CG animation techniques like inverse kinematic or animation constraint systems are used to calculate the pose of a character on run time. The absence of any limitations as they exist with parametric animation type makes procedural animations powerful but also limited at the same time. Procedural animations have a tendency to be robotic and not life like since they are driven by mathematics instead of an artistic hand (or mo-capped). Often procedural animations are used only to adjust parametric animations to give the illusion of a larger set of animations. Pure procedural animation systems are usually not often found due to the mentioned limitations and problems with this technique (depends though a lot on the game in question). Physics based animation also belongs into this category since the principle is the same just that physical functions are used.
  
-**Procedural Animation**\\ 
-Procedural animations are the most dynamic type of animations often not requiring animation sequences at all. Here movie CG animation techniques like inverse kinematic or animation constraint systems are used to calculate the pose of a character on run time. The absence of any limitations as they exist with parametric animation type makes procedural animations powerful but also limited at the same time. Procedural animations have a tendency to be robotic and not life like since they are driven by mathematics instead of an artistic hand ( or mo-capped ). Often procedural animations are used only to adjust parametric animations to give the illusion of a larger set of animations. Pure procedural animation systems are usually not often found due to the mentioned limitations and problems with this technique ( depends though a lot on the game in question ). Physics based animation also belongs into this category since the principle is the same just that physical functions are used. 
-\\ 
-\\ 
-<WRAP boxheader> 
 ====== Animator System ====== ====== Animator System ======
-</WRAP> 
-<WRAP boxcontent> 
 The main idea behind the animator system is to separate the animation logic from the animation production. In most systems these two parts are intervened. While this has advantages it also imposes limitations and locks game developers to a given type of animation. The animator system in contrary provides the game designer with a simple to use system where he decides how the animations are build instead of using a pre-build system. To use an animator you have to assign it a component upon which the produced animations are applied. Optionally you can assign the animator an animation which will be used by some rules to retrieves animation sequences from. This is not required if you do not plan to use animation sequences but only procedural ones. Once setup you can apply the animation to the assigned component. Using the source and destination blend factor you can blend the animation state produced by the animator. This way you can either blend a calculated animation with a state calculate by the physics system ( for example make an unconscious body regain consciousness ) or apply multiple animators in succession. This can be used to separate different kinds of animation scenarios into manageable units ( one animator per scenario ) doing transitions between them. You can also skip animators altogether and apply your self calculated bone states to the component directly. Using animators is though the way to go since this way advantage can be taken of future hardware solutions as well as better animation algorithms. The main idea behind the animator system is to separate the animation logic from the animation production. In most systems these two parts are intervened. While this has advantages it also imposes limitations and locks game developers to a given type of animation. The animator system in contrary provides the game designer with a simple to use system where he decides how the animations are build instead of using a pre-build system. To use an animator you have to assign it a component upon which the produced animations are applied. Optionally you can assign the animator an animation which will be used by some rules to retrieves animation sequences from. This is not required if you do not plan to use animation sequences but only procedural ones. Once setup you can apply the animation to the assigned component. Using the source and destination blend factor you can blend the animation state produced by the animator. This way you can either blend a calculated animation with a state calculate by the physics system ( for example make an unconscious body regain consciousness ) or apply multiple animators in succession. This can be used to separate different kinds of animation scenarios into manageable units ( one animator per scenario ) doing transitions between them. You can also skip animators altogether and apply your self calculated bone states to the component directly. Using animators is though the way to go since this way advantage can be taken of future hardware solutions as well as better animation algorithms.
  
 ===== Controller ===== ===== Controller =====
-Controllers provide the connection between the animation logic and the animation production. The game developer uses in his game a given set of variables to track the state of an actor for example. The idea is to allow the game developer to map these variables directly to the animation system not having to worry about converting them into whatever system one might use. This is done using the controllers which act as dial knobs the game developer can mock around with like on a mixer. Each controller has a minimum and maximum value. The current value of the controller is always kept inside this boundary. The game developer can set here the limits of the values he uses in his variables. He is not required to normalize or otherwise apply fancy math to the values in his game to match them with the animation system. It's the animator system that adapts to the game developer. Controllers can either clamp or wrap values outside the limits. Clamping is typically used for controllers attached to actions like raising or lowering the head where you want the motion to stop at the extreme points. Wrapping on the other hand is used if the controller is incremented with respect to the elapsed time. Hence using clamping an animation would stop at the end while with wrapping it would loop forever. The game developer is responsible to increment the value of a controller if it is supposed to be driven by the elapsed time. This can be done easily using an increment function which does all the clamping or wrapping for you. In addition controllers can be frozen which prevents their current value from changing. This way the game designer is not required to keep track in his game when to manipulate a controller and when to spare it. On a frozen controller all methods intended to change the value will be silently ignored. It is fully valid to call such methods on a frozen controller. The controller normalizes the current value itself. A particularity about the controllers is that they own in addition to the single value also a 4-component vector value. This value is used by specific rules and is neither clamped nor altered. The order of the controllers is important since they are referenced by their index later on.+Controllers provide the connection between the animation logic and the animation production. The game developer uses in his game a given set of variables to track the state of an actor for example. The idea is to allow the game developer to map these variables directly to the animation system not having to worry about converting them into whatever system one might use. This is done using the controllers which act as dial knobs the game developer can mock around with like on a mixer. 
 + 
 +Each controller has a minimum and maximum value. The current value of the controller is always kept inside this boundary. The game developer can set here the limits of the values he uses in his variables. He is not required to normalize or otherwise apply fancy math to the values in his game to match them with the animation system. It's the animator system that adapts to the game developer. Controllers can either clamp or wrap values outside the limits. 
 + 
 +Clamping is typically used for controllers attached to actions like raising or lowering the head where you want the motion to stop at the extreme points. Wrapping on the other hand is used if the controller is incremented with respect to the elapsed time. Hence using clamping an animation would stop at the end while with wrapping it would loop forever. The game developer is responsible to increment the value of a controller if it is supposed to be driven by the elapsed time. This can be done easily using an increment function which does all the clamping or wrapping for you. 
 + 
 +In addition controllers can be frozen which prevents their current value from changing. This way the game designer is not required to keep track in his game when to manipulate a controller and when to spare it. On a frozen controller all methods intended to change the value will be silently ignored. It is fully valid to call such methods on a frozen controller. The controller normalizes the current value itself. 
 + 
 +A particularity about the controllers is that they own in addition to the single value also a 4-component vector value. This value is used by specific rules and is neither clamped nor altered. 
 + 
 +The order of the controllers is not important since they are referenced by their name later on. It is also possible to refer to them by index for specific use cases.
  
 ===== Link ===== ===== Link =====
-Controllers deliver a linear and normalized value. This is though not always the desired result. For example an animation sequence could be desire to have full influence for a controller value or 0 decreasing linearly down to no influence at the point 0.5  while staying at no influence up to the value 1. Links take on the duty to map controller values to actual weight values which can be consumed by rules later on. A link consist of a piecewise linear curve which maps incoming controller values ( x coordinate ) to weight values ( y coordinate ). Furthermore the source controller is indicated using the index of the controller ( for speed and handling reasons not a pointer ). A link is valid if the source controller is a valid index of a controller otherwise it is an empty link. Vector values of controllers are not altered by the mapping curve in any ways and are handed to the target as they are. The order of links is important since they are referenced by their index later on.+Controllers deliver a linear and normalized value. This is though not always the desired result. For example an animation sequence could be desire to have full influence for a controller value or 0 decreasing linearly down to no influence at the point 0.5  while staying at no influence up to the value 1. Links take on the duty to map controller values to actual weight values which can be consumed by rules later on. 
 + 
 +A link consist of a piecewise linear curve which maps incoming controller values (x coordinate) to weight values (y coordinate). Furthermore the source controller is indicated using the index of the controller (for speed and handling reasons not a pointer). 
 + 
 +A link is valid if the source controller is a valid index of a controller otherwise it is an empty link. 
 + 
 +Vector values of controllers are not altered by the mapping curve in any ways and are handed to the target as they are. The order of links is important since they are referenced by their index later on.
  
 ===== Target ===== ===== Target =====
 Targets define the sink of values delivered by links. Every rule has one or more targets referring to attributes that can be dynamically altered. As with controllers the links are referenced by index instead of a pointer for the same reasons. A target can have any number of links assigned. If more than one link is assigned the value delivered by them are multiplied to produce the final weight value used by the attribute in question. Only valid links influence a target. A target is bound if it contains at least one valid link otherwise it is unbound. For a bound target the attribute in question takes on the value of the target. If the target is unbound a default value ( usually stored separately in the rule itself ) is used. This means especially that if you have links assigned to a target it is still possible that the default value is used if none of the links is valid. Targets expecting a vector take the vector of the first valid link. No merging of vectors of multiple links is conducted. Targets define the sink of values delivered by links. Every rule has one or more targets referring to attributes that can be dynamically altered. As with controllers the links are referenced by index instead of a pointer for the same reasons. A target can have any number of links assigned. If more than one link is assigned the value delivered by them are multiplied to produce the final weight value used by the attribute in question. Only valid links influence a target. A target is bound if it contains at least one valid link otherwise it is unbound. For a bound target the attribute in question takes on the value of the target. If the target is unbound a default value ( usually stored separately in the rule itself ) is used. This means especially that if you have links assigned to a target it is still possible that the default value is used if none of the links is valid. Targets expecting a vector take the vector of the first valid link. No merging of vectors of multiple links is conducted.
-</WRAP> 
  
-<WRAP boxheader> 
 ====== Rule ====== ====== Rule ======
-</WRAP> +Rules provide the production rules for an animation. There exist various rules each belonging to one of the three animation types. All rules together have common properties. 
-<WRAP boxcontent> + 
-Rules provide the production rules for an animation. There exist various rules each belonging to one of the three animation types. All rules together have common properties. Each rule can be enabled and disabled individually which allows to modify the animation production process without altering the rules itself ( which is faster ). The result of each rule is blended with the existing animation state using the source and destination blend factor. The rule animation state is multiplied with the source factor and added to the existing animation state multiplied by the destination factor. For both the blend factors there exists an appropriate target. This can be used to alter the influence strength of a rule which is useful to gradually blend in animations ( for example an idle animation or typically used on inverse kinematic rules to avoid jumping ). By default the source factor is set to 1 and the destination factor to 0. A typical setting is 1 for both in which case the animation state of the rule is added to the existing one ( used for doing parametric animation setups ). In addition each rule has a list of bones. This list indicates which bones are affected by this rule and can be used to apply rules only to subsets of a character ( for example torso and legs separately ). If the bone list is empty this equals to the rule influencing all bones. The order of rules is important since they are applied in the order they are specified. The following list contains all existing rules.+Each rule can be enabled and disabled individually which allows to modify the animation production process without altering the rules itself (which is faster). 
 + 
 +The result of each rule is blended with the existing animation state using the source and destination blend factor. The rule animation state is multiplied with the source factor and added to the existing animation state multiplied by the destination factor. For both the blend factors there exists an appropriate target. This can be used to alter the influence strength of a rule which is useful to gradually blend in animations (for example an idle animation or typically used on inverse kinematic rules to avoid jumping). By default the source factor is set to 1 and the destination factor to 0. A typical setting is 1 for both in which case the animation state of the rule is added to the existing one (used for doing parametric animation setups). 
 + 
 +Each rule has a list of bones. This list indicates which bones are affected by this rule and can be used to apply rules only to subsets of a character (for example torso and legs separately). If the bone list is empty this equals to the rule influencing all bones. 
 + 
 +Each rule has a list of vertex position sets (aka "blend shapes", "morph shapes" or similar names). This list indicates which vertex position sets are affected by this rule and can be used to apply rules only to subsets of a character (for example certain mouth shapes). If the vertex position set list is empty this equals to the rule influencing all vertex position sets. 
 + 
 +The order of rules is important since they are applied in the order they are specified. The following list contains all existing rules.
  
 ===== Animation ===== ===== Animation =====
Line 44: Line 63:
 The animation difference rule works similar to the animation rule in that it takes frames from an animation sequence. The difference is that two frames are queried at the same time and the difference between both becomes the result of the rule. This can be used to apply an animation relative to the existing one ( for example a turret motion ). For both frames the move name and the time can be specified. The same rules apply as for the animation rule. Care has to be taken to not obtain zero quaternions which happens if both frames have the same orientation. Usually this rule is used with the source and destination blending factors 1 and 1 to add the difference to the existing animation. In this case zero quaternions are no problem. For both the leading ( the frame to take the difference from ) and the reference ( the frame to subtract from the former ) frame time there exists a target which behaves as the one in the animation rule. The animation difference rule works similar to the animation rule in that it takes frames from an animation sequence. The difference is that two frames are queried at the same time and the difference between both becomes the result of the rule. This can be used to apply an animation relative to the existing one ( for example a turret motion ). For both frames the move name and the time can be specified. The same rules apply as for the animation rule. Care has to be taken to not obtain zero quaternions which happens if both frames have the same orientation. Usually this rule is used with the source and destination blending factors 1 and 1 to add the difference to the existing animation. In this case zero quaternions are no problem. For both the leading ( the frame to take the difference from ) and the reference ( the frame to subtract from the former ) frame time there exists a target which behaves as the one in the animation rule.
  
-===== Bone Rotator ===== +===== Animation Select ===== 
-The bone rotator rule is a procedural rule which allows to rotate bones relative to a coordinate frame. This is useful to apply motions like turning the head or torso left and right ( or up and down works too depending on the character ). A minimum and maximum orientation in Euler angles has to be provided. The rotation target value determines the orientation to be picked with 0 retrieving the minimum orientation and 1 the maximum orientation ( with all other values a linear blend between the two ). By default the rotation takes place around the center of each bone ( each bone is operated on individually and independent of all others ) with the orientation of the coordinate frame equal to the one of the component. This simply rotates the bones around their position relative to the component. If bone local rotation is disabled the bones are rotated around the component center instead. Since the rotation is specified in non-clamped Euler angles you can specify rotations outside the 90 degree range without obtaining strange results.+The animation select rule works similar to the animation rule in that it takes frames from an animation sequence. The difference is that a list of animation sequences can be defined. Using the select target one animation sequence is selected from the list. 0 target value picks the first entry in the list. 1 target value picks the last entry in the list. All other entries in the list are linearly mapped. Only one animation sequence is picked. To blend multiple animation sequences use group rule with animation rules as children.haves as the one in the animation rule. 
 + 
 +===== Bone Transformator ===== 
 +The bone transformat rule is a procedural rule which allows to transform bones relative to a coordinate frame. This is useful to apply motions like turning the head or torso left and right (or up and down works too depending on the character). A minimum and maximum translation, orientation in Euler angles or scaling has to be provided. The position, rotation and size target value determines the transformation to be picked with 0 retrieving the minimum orientation and 1 the maximum orientation (with all other values a linear blend between the two). By default the transformation takes place around the center of each bone (each bone is operated on individually and independent of all others) with the orientation of the coordinate frame equal to the one of the component. This simply transforms  the bones around their position relative to the component. If bone local is disabled the bones are transformed around the component center instead. Since the rotation is specified in non-clamped Euler angles you can specify rotations outside the 90 degree range without obtaining strange results.
  
 ===== Inverse Kinematic ===== ===== Inverse Kinematic =====
Line 58: Line 80:
 ===== Foreign State ===== ===== Foreign State =====
 The foreign state rule applies the state of a specific bone to the influenced bones. This can be used to transfer a state from one bone to another. Typically these are bones which are not animated otherwise as for example attachments on clothing which are applied to an actor and should animate reasonably with it. You can determine relative to which coordinate system ( bone or component ) the state is obtained and and applied. It is possible to mix those ( for example obtaining the state relative to the component but applying it relative the the bone local coordinate system for the target bones ) but usually for both component space is used. You can specify for each attribute individually a scaling factor with which the incoming bone state is first multiplied. This scaling factor also owns a target for each attribute. Scaling can be used to weight multiple bones into a new one. For example if you have an attachment which is located halfway between two animated bones you can use two foreign state rules one for each bone scaling them by 0.5 and adding the result to obtain the final bone position. Each attribute can be enabled separately which prevents altering the appropriate attribute. The foreign state rule applies the state of a specific bone to the influenced bones. This can be used to transfer a state from one bone to another. Typically these are bones which are not animated otherwise as for example attachments on clothing which are applied to an actor and should animate reasonably with it. You can determine relative to which coordinate system ( bone or component ) the state is obtained and and applied. It is possible to mix those ( for example obtaining the state relative to the component but applying it relative the the bone local coordinate system for the target bones ) but usually for both component space is used. You can specify for each attribute individually a scaling factor with which the incoming bone state is first multiplied. This scaling factor also owns a target for each attribute. Scaling can be used to weight multiple bones into a new one. For example if you have an attachment which is located halfway between two animated bones you can use two foreign state rules one for each bone scaling them by 0.5 and adding the result to obtain the final bone position. Each attribute can be enabled separately which prevents altering the appropriate attribute.
-</WRAP> 
  
-<WRAP youarehere> +===== Group ===== 
-[[:start|Start Page]] >> [[gamedev:main|Game Development with the Drag[en]gine]] >> **Animators and Animation** +The group rule applies a list of child rules. The rules can be applied using all or select mode. In all mode all rules are applied similar to how animation rules are applied in general. If the select mode is used the select target picks two children rules and blends between them linearly. A target value of 0 picks the first rule. A target value of 1 picks the last rule. All other rules are mapped linearly across the range from 0 to 1. If you want to seamlessly blend back to the first rule when approaching a target value of 1 you have to duplicate the first rule as last rule. 
-</WRAP>+ 
 +===== Sub Animator ===== 
 +The sub animator rule applies an animator file as if the content of the file is present instead of the sub animator rule. This allows to reuse animators and simplifies creating complex animation systems. By default controllers of the sub animator are matched by name against the controllers of this animator. The controller value and vector are copied unmodified to the sub animator before running. Optionally you can define manual mapping replacing the default one. 
 + 
 +===== Track To ===== 
 +The track to rule adjusts the orientation of the affected bones to point towards a target bone. 
 + 
 +===== Limit ===== 
 +The limit rule clamps the position, orientation and scale parameters of affected bones to predefined ranges. 
gamedev/animators.1354290181.txt.gz · Last modified: 2012/11/30 15:43 by dragonlord