Blending & State MachinesBlending & SequencingSlide 3Animation PlaybackPosesAnimation ClipAnimation PlayerSlide 8Slide 9Slide 10Slide 11Slide 12Animation BlendingBlending OverviewGeneric Blend OperationCross DissolveSlide 17Cross Dissolve: Handling AnglesCross Dissolve: QuaternionsCross Dissolve: Stand to WalkSlide 21Cross Dissolve: Walk to RunSlide 23Slide 24Slide 25Slide 26Slide 27Basic Math Blend OperationsSlide 29Add & Subtract BlendersScale BlenderMath Operations: Body TurnBody TurnSlide 34Bilinear BlendSlide 36Slide 37Combine BlenderMirror BlenderClamp BlenderMulti-Track BlendingAnimation State MachinesState MachinesSlide 44Slide 45Simple Jump State MachineMore Complex JumpState Machine (Text Version)State Machine ExtensionsCreating State MachinesCharacter MoverSlide 52Slide 53Character Mover: WalkingSlide 55Slide 56Blending & State MachinesCSE169: Computer AnimationInstructor: Steve RotenbergUCSD, Winter 2005Blending & SequencingNow that we understand how a character rig works and how to manipulate animation data, we can edit and play back simple animationThe subject of blending and sequencing encompasses a higher level of animation playback, involving constructing the final pose out of a combination of various inputsWe will limit today’s discussion to encompass only pre-stored animation (channel) data as the ultimate input. Later, we will consider how to mix in procedural animation…Blending & SequencingMost areas of computer animation have been pioneered by the research and special effects industriesBlending and sequencing, however, is one area where video games have made a lot of real progress in this area towards achieving interactively controllable and AI characters in complex environments…The special effects industry is using some game related technology more and more (battle scenes in Lord of the Rings…)Animation PlaybackPosesA pose is an array of values that maps to a rigIf the rig contains only simple independent DOFs, the pose can just be an array of floatsIf the rig contains quaternions or other complex coupled DOFs, they may require special handling by higher level codeTherefore, for generality, we will assume that a pose contains both an array of M≥0 floats and an additional array of N≥0 quaternions 1010......NMqqAnimation ClipRemember that the AnimationClip stores an array of channels for a particular animation (or it could store the data as an array of poses…)This should be treated as constant data, especially in situations where multiple animating characters may simultaneously need to access the animation (at different time values)For playback, animation is accessed as a pose. Evaluation requires looping through each channel.class AnimationClip {void Evaluate(float time,Pose &p);}Animation PlayerWe need something that ‘plays’ an animation. We will call it an animation play erAt it’s simplest, an animation player would store a AnimationClip*, Rig*, and a float timeAs an active component, it would require some sort of Update() functionThis update would increment the time, evaluate the animation, and then pose the rigHowever, for reasons we will see later, we will leave out the Rig* and just have the player generate and output a PoseAnimation Playerclass AnimationPlayer {float Time;AnimationClip *Anim;Pose P;public:void SetClip(AnimationClip &clip);const Pose &GetPose();void Update();};Animation PlayerA simple player just needs to increment the Time and access the new pose once per frameThe first question that comes up though, is what to do when it gets to the end of the animation clip?Loop back to startHold on last frameDeactivate itself… (return 0 pose?)Send a message…Animation PlayerSome features we may want to add for a more versatile animation player include:Variable playback ratePlay backwards (& deal with hitting the beginning)PauseIt’s kinda like a DVD player…Animation PlayerThe animation player is a basic component of an animation blending & sequencing systemMany of these might ultimately be combined to get the final blended pose. This is why we only want it to output a poseBy the way, remember the issue of sequential access for keyframes? The animation player should ultimately be responsible for tracking the current keyframe array (although the details could be pushed down to a specific class for dealing with that)Animation PlayerAs we will use players and static poses as basic components in our blending discussion, we will make a notation for them:look_right walkcurrent pose(Animation Player)static poseAnimation BlendingBlending OverviewWe can define blending operations that affect posesA blend operation takes one or more poses as input and generates one pose as outputIn addition, it may take some auxiliary data as input (control parameters, etc.)Generic Blend OperationBLENDERauxdatapose1 ...poseNoutput poseCross DissolvePerhaps the most common and useful pose blend operation is the ‘cross dissolve’Also known as: Lerp (linear interpolation), blend, dissolve…The cross dissolve blender takes two poses as input and an additional float as the blend factor (0…1)Cross DissolveThe two poses are basically just interpolatedThe DOF values can use Lerp, but the quaternions should use the ‘Slerp’ operation (spherical linear interpolate) 21212121sinsinsin1sin,,1,,qqqqqtttSlerptttLerpCross Dissolve: Handling AnglesIf a DOF represents an angle, we may want to have the interpolation check for crossing the +180 / -180 boundaryUnfortunately, this complicates the concept of a DOF (and a pose) a bit more. Now we must also consider that some DOFs behave in different ways than others 2121122121,, 360,, 180 ,360, 180tLerpelsetLerpifelsetLerpifCross Dissolve: QuaternionsAlso, for quaternions, we may wish to force the interpolation to go the ‘short way’: 212121,, ,, 0qqqqqqqqtSlerpel setSle rpifCross Dissolve: Stand to WalkConsider a situation where we want a character to blend from a stand animation to a walk animationDISSOLVEoutput posefstand walkCross Dissolve: Stand to WalkWe could have two independent
View Full Document