「Dev:2.4/Source/Animation/AnimationBaking」の版間の差分

提供: wiki
移動先: 案内検索
(Bake object-level to action-level for armatures)
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 02:51時点における最新版

Animation Conversion and Baking

Animation Conversion refers to the process of converting one type of animation (path, keyframe, object-level, character-level, nla-based, etc.) to another. In some cases, animation data can be directly converted, resulting in a simple reformatting of data, while in others, the process is necessarily destructive, requiring a sample rate, called baking.

Ctrl-I is the global hotkey for animation baking and conversion, as it is really key-creation on speed.

How Animators Use Baking

Baking and animation conversion open up a whole host of possibilities for animators. Here are a few examples.

  • Building a walkcycle and using it in conjunction with path and stride tools is insufficient for lead-character animation in most cases. The results are repetitive and would be need to be tweaked and sweetened to be really useful. There are other situations where a repeated cycle or action might suffice, but need to be broken in the middle with a mild to major variation. With Baking, a repeating walkcycle can be converted into a single, editable Action, allowing the animator to begin their work with the speed of setup that using the stride/path tools provide, then tweak and alter the result even down to the Ipo level.
  • Blending library actions in the NLA Editor can produce okay results, but once again for hero level animation, it just doesn't cut it. If the transition between strips isn't nice, there is not much you can do. With Baking, you create a single, editable Action from the blended animation which you can sweeten and fix to your heart's content.
  • It speeds up animators jobs by allowing to use the NLA as a blocking tool, quickly adding library actions and repetition. After they have the gross motion blocked out in NLA, they Bake and really begin to work on the final animation.

Baking/Conversion Types

The main types of conversions that are possible:

  • Bake object-level to action-level for armatures
  • Bake NLA strips into a single strip
  • Bake generic motion (parent/constraint/track/path-based) into key framed motion
  • Convert key framed motion into path animation

Bake object-level to action-level for armatures

Tests have indicated that simply using the keyframes from an armature's object-level motions as key frames for its root bones produces completely unsatisfactory results. For that reason, a baking approach with a sample rate is needed for this task.

Inputs to this procedure are an armature, a sample frame rate and a frame range.

Triggered by pressing Ctrl-I in the 3D view on a selected armature, appearing as "Object Level to Action" on the Animation Baking popup. This could also appear as a header menu item within the Ipo, Action and NLA Editor windows.

  • Within the frame range, a matrix is recorded once for each step on the frame rate;
  • The armature is unlinked from its object-level Ipo, as well as any object-level constraints and relationships that affected its transformation;
  • A new action is created;
  • Each of the root bones in the armature receive new keys so that their global transformation on that frame matches the global transformation of the same bone during the previous matrix-sample;
  • Hinge bones receive keys based on the non-translation portions of the matrix;
  • If called from the NLA window, a new strip with the action is added to the NLA for the armature.

Bake NLA strips into a single strip

Inputs to this procedure are NLA strips attached to an armature.

Triggered by pressing Ctrl-I in the NLA Editor, with strips selected.

  • A new action is created, unlinked, and populated with a logical OR of the channels of the selected strips;
  • Sampling begins on the first frame of the first NLA strip;
  • A pose based on the selected strips is determined;
  • The pose is recorded in the new action using the "Available" and "Needed" key setting algorithms;
  • The next sample is taken on the next frame that holds a keyframe for any channel in any of the selected strips;
  • Sampling ends when the last frame of the last selected strip is reached.
  • The new action is added to NLA as a strip, while the originally selected strips are muted.

Bake arbitrary transformation (parent/constraint/track/path-based) into key framed transformation

Inputs to this procedure are an object, a sample frame rate and a frame range.

Triggered by pressing Ctrl-I in a 3D view with an object selected, appearing as "All animation to key frames" on the Animation Baking popup.

  • Within the frame range, a matrix is recorded once for each step on the frame rate;
  • The object is unlinked from all entities that could produce transformation (Ipo, parent-child, constraints, etc.);
  • A new Ipo is created, with keys every sample frame, based on the recorded matrices.

Convert key framed motion into path animation

Testing has yet to determine if a direct conversion is possible, but I suspect it is.

Inputs to this procedure are an object with linked transformation Ipo.

Triggered by pressing Ctrl-I in a 3D view with an object selected, appearing as "Key frames to Path" on the Animation Baking popup.

  • Unlink the Ipo from the object (or bone);
  • Using the keys and handles on the various Ipo curves, create a single 3D bezier curve that matches the original animation in transformation and timing;
  • Build a link between the object and the new curve via a FollowPath constraint.

Challenges

Challenges to this project are that when sampling, especially in NLA, several internal functions that deal with poses only use int frame numbers, and we lose precision when working with scaled or repeated actions. Possible solutions are to convert frame to a float throughout Blender (although Ton has clearly stated that he does not want that), or to simply convert the necessary functions into using float frames, then make the original function names int-to-float wrappers so everything works as previous, but with additional functionality to coders that need it.

User Interaction

For the frame range required by several of the options, either the animation range (Start/End) or the new animation preview range could be used. The sample rate would be a new control in the Anim/Playback sub-context of the Scene context.

Python API would allow the triggering of any of these procedures from python, directly specifying the frame range and sample rates without internal reference to the GUI controls. This would allow scripts to use various settings for baked projects without relying on changing global settings each time.

Down the Road

One future vision after animation baking actually works is to virtualize the baking. With virtual baking, you could, say, virtually bake object-level to action level motion for an armature, with all the goodies that allows you for NLA work, but the original Ipos and things that generated the object-level animation aren't unlinked. They are put in an "on hold" state, while the baked Action takes control. Since the baking is virtualized, you can still go back and edit the original controls, key frames/constraints/etc. at the object level, but have the changes show up in the virtually baked action.

Another use for virtualization is to allow users to keyframe the object-level motion of an armature, then virtually baked that into a path. Then, you can use offset bone in the NLA in conjunction with that path. But, to change the animation you would only have to edit the original key frames, while the virtually baked path self-adjusts.