Blending & State MachinesIssuesBlending & SequencingSlide 4Keyframe ChannelsKeyframe AccessChannel::Precompute()Computing TangentsFlat TangentsLinear TangentsSmooth TangentsStep TangentComputing Cubic CoefficientsSlide 14Channel::Evaluate()Finding the SpanFinding the Span: Binary SearchFinding the Span: Linear SearchEvaluating the CubicHigh Performance ChannelsRobustnessProject 3ReferencesAnimation PlaybackPosesAnimation ClipAnimation PlayerSlide 28Slide 29Slide 30Slide 31Slide 32Animation BlendingBlending OverviewGeneric Blend OperationCross DissolveSlide 37Cross Dissolve: Handling AnglesCross Dissolve: QuaternionsCross Dissolve: Stand to WalkSlide 41Cross Dissolve: Walk to RunSlide 43Slide 44Slide 45Slide 46Slide 47Basic Math Blend OperationsSlide 49Add & Subtract BlendersScale BlenderMath Operations: Body TurnBody TurnSlide 54Bilinear BlendSlide 56Slide 57Combine BlenderMirror BlenderClamp BlenderMulti-Track BlendingAnimation State MachinesState MachinesSlide 64Slide 65Simple Jump State MachineMore Complex JumpState Machine (Text Version)State Machine ExtensionsCreating State MachinesCharacter MoverSlide 72Slide 73Character Mover: WalkingSlide 75Slide 76Blending & State MachinesCSE169: Computer AnimationInstructor: Steve RotenbergUCSD, Winter 2004IssuesThe midterm is next ThursdayProject 1 sample on the web pageHopefully, I will have some morph files and texture examples on the web page by tomorrowStill grading project 1Blending & 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…)Keyframe ChannelsKeyframe Accessclass Keyframe {float Value,Time;char RuleIn,RuleOut;float TangentIn,TangentOut;float A,B,C,D;}class Channel {float Evaluate(float time);void Precompute();}Channel::Precompute()The two main setup computations a keyframe channel needs to perform are:Compute tangents from rulesCompute cubic coefficients from tangents & other dataThis can be done in two separate passes through the keys or combined into one pass (but keep in mind there is some slightly tricky dependencies on the order that data must be processed if done in one pass)Computing TangentsBoth the incoming and outgoing tangents need to be generated for each keyframeTangents are generated from simple ‘rules’Flat: tangent = 0Fixed: tangent = some constantLinear: tangent points to next/last keySmooth: tangent equals slope formed by next & last keyThe first two are trivial, the third is simple, and the fourth is pretty simple too…Note: I use ‘v’ for tangents (velocity) instead of ‘t’ which is used for timeFlat TangentsFlat tangents are particularly useful for making ‘slow in’ and ‘slow out’ motions (acceleration from a stop and deceleration to a stop)••••v = 0Linear Tangents••(p0,t0)v0outv1in(p1,t1)010110ttppvvinoutSmooth Tangents•(p1,t1)v1outv1in020211ttppvvoutin••(p2,t2)(p0,t0)Keep in mind that this won’t work on the first or last tangent (just use the linear rule)Step TangentOccasionally, one comes across the ‘step’ tangent ruleThis is a special case that just forces the entire span to a constantThis requires hacking the cubic coefficients (a=b=c=0, d=p0)It can only be specified on the outgoing tangent and it nullifies whatever rule is on the next incoming tangent••••Computing Cubic CoefficientsOnce we have the tangents for every keyframe, we can compute the cubic coefficients (a,b,c,d) for each spanUsually, these are just stored with the keyframe at the start of the span 101001100001010012331122vttvttppdcbaHrmHrmGBC Computing Cubic CoefficientsNote: My matrix34 class won’t do this properly!Tough! Do it yourself! Actually, all of the 1’s and 0’s in the matrix make it pretty easy to multiply it out by hand 101001100001010012331122vttvttppdcbaChannel::Evaluate()The Channel::Evaluate function needs to be very efficient, as it is called many times while playing back animationsThere are two main components to the evaluation:Find the proper spanEvaluate the cubic equation for the spanFinding the SpanAssuming we are doing a ‘random access’ of the channel, we need to first locate where the specified t value isThere are 4 main possibilitiest < tstart (before first key: use extrapolation)t > tend (after last key: use extrapolation)t is on a keyt is on a span between keys (most likely)Finding the Span: Binary SearchA very reasonable way to find the key is by a binary search. This allows pretty fast (log N) access time with no additional storage cost (assuming keys are stored in an array (rather than a list))Binary search is sometimes called ‘divide and conquer’ or ‘bisection’For even faster access, one could use hashing algorithms, but that is probably not necessary, as they require additional storage and most real channel accesses can take advantage of coherence (sequential access)Finding the Span: Linear SearchOne can always just loop through the keys from the beginning and look for the proper spanThis is an acceptable place to start, as it is important to get things working properly before focusing on optimizationIt may also be a reasonable option for interactive editing tools that would require key frames to be stored in a linked listOf
View Full Document