Computer Animation Animation • Animate = “to give life to” • Specify, directly or indirectly, how ‘thing’ moves in time and space Angel Games Animation Applications • • • • • • • • Special Effects (Movies, TV) Video Games Virtual Reality Simulation, Training, Military Medical Robotics, Animatronics Visualization Communication Animation • How do we describe and generate motion of object in the scene? Animation File Formats Software File Format Director .dir & .dcr Animator Pro .fli Studio Max .max SuperCard and Director .pics Windows Audio Video Interleaved .avi Macintosh .qt & .mov Motion Video .mpeg CompuServe .gif Flash .swf Shockwave .dcr Web Page Animation File Formats (1) • GIF Files –GIF89a’s ability to store a sequence of images has been used to provide a cheap and cheerful form of small animation for Web page advertisements. Web Page Animation File Formats • (2) GIF Shortcomings: However, even when GIF animation is properly implemented and enabled, it has many shortcomings. 1) Sound can not be added. 2) Colour palette is restricted to 256. 3) Images are losslessly compressed. QuickTime • For animation of any duration, especially if it is accompanied by sound, the best result will be achieved using a video format, and QuickTime has become the standard. Heritage of Animation • Persistence of vision: discovered about 1800s – Zoetrope or “wheel of life” – Flip-book Heritage of Animation • Camera to make lifeless things move – Meleis 1890 using simple tricks – Emil Cohl (1857-1938, French) Disney: Animation as an art form • Innovations – Story board to review story – Pencil sketch to review motion – Multi-plane camera stand – Color (not first to use color) – Sound! • Steamboat Willie (1928) Two main categories • Computer-assisted animation – 2D & 2 1/2 D – Inbetweening – Inking, virtual camera, managing data, etc • Computer generated animation – Low level techniques • Precisely specifying motion – High level techniques • Describe general motion behavior Low level techniques • Shape interpolation (in-betweening) • Have to know what you want High level techniques • Generate motion with set of rules or constraints – Physically based motion http://www.cs.berkeley.edu/~job/Projects/SoundGen/video.html Why animation works • The eye cannot register images faster than approximately 60 frames per second (30 is just about adequate) • If a gap in the projection occurs, the eye seems to perform spatial interpolation over the gap Animation and Frame Rates • TV video builds 30 entire frames or pictures every second. • Movies are shot at a shutter rate of 24 frames per second, but using projections tricks the flicker is increased to 48. • On some projectors each frame is shown 3 times before the next frame, for a total of 72 flickers per second which helps eliminate the flicker effect. • Cel Animation – plays at 24 frames per second. Displaying animation sequences • To achieve smooth animation, a sequence of images (frames) have to be presented on a screen with the speed of at least 30 per second • Animations frames can be – pre-computed in advance and pre-loaded in memory – computed in real time (e.g. movement of the cursor) Raster animation • This is the most common animation technique • Frames are copied very fast from off-screen memory to the frame buffer • Copying can be applied to – complete frames – only parts of the frame which contain some movement Examples Ship is redrawn in background colour Step 1 (erase) (x,y) Step 2 (move) (x,y) (x+Dx,y+Dy) x’ = x + Dx y’ = y + Dy Move ship Step 3 (draw) (x’,y’) Double buffering • Used to achieve smooth animation • The next frame of animation is computed to an off-screen buffer at the same time when the current frame is transferred to the frame buffer. Create Frame Load to the frame buffer Create Frame Load to the frame buffer Create Frame Load to the frame buffer Time 2-D Animation Two types: Cel animation Path animation Cel Animation • Made famous by Disney • 24 frames per second therefore a minute may require as many as 1,440 separate frames. • It is based on changes that occur from one frame to the next. • Cel stands for celluloid which is a clear sheet with images drawn on them. • The celluloid images are place on a background that is usually stationary. • The background remain fixed as the images changes. Cel Animation • Those elements in a scene that might move are drawn on sheets of transparent material known as ‘cel’, and laid over a background drawn separately. Path Animation • Moves an object along a predetermined path on the screen • The path can be a straight line or have a number of curves. • Starts with keyframes (the first and last frame of an action). • The series of frames in between the keyframes are drawn in a process called tweening. • Tweening requires calculating the number of frames between keyframes and the path the action takes, and then actually takes, and then sketches a series of progressively different outlines. 3-D Animation • 3-D Animation involves three steps: modeling, animation, and rendering Modeling – the process of creating objects and scenes Animation – the process of defining the object’s motion Rendering – the final step in creating 3-D animation. • Morphing is the process of blending two images into a series of images • Warping allows you to distort a single image • Virtual reality (VR) creates an environment that surrounds the user so that they become part of the experience. Hybrid Forms of Animation • Mixing cel and 3-D • Combining animation with live footage such as Jurassic Park. • Add time -> 4D Steps of a simple computer animation 1. Creating animation sequences – object definition – path specification (for an object or a camera) – key frames – in-betweening 2. Displaying the sequences – raster animation – colour-table animation Object definition • In simple manual systems, the objects can be simply the artist drawings • In computer-generated animations, models are used • Examples of models: – a "flying logo" in a TV advert – a walking stick-man – a dinosaur attacking its prey in Jurassic Park Character Development • 300 Drawings Character Development • 40 Sculptures Character Development • Computer Models Storyboarding • Explicitly define – Scenes – Camera shots – Special effects – Lighting – Scale • Used as guide by animators Layout and Look • Build scenery • Match colors Path specification • Impression of movement can be created for two basic situations, or for their combination: – static object, moving camera – static camera, moving object • The path defines the sequence of locations (for either the camera or the object) for the consecutive time frames Static object, moving camera Time F1 F5 F2 F4 F3 Static camera, moving object F1 F2 F3 F4 It is important to remember that when the object moves along the path, not only its position changes, but also its orientation Y Y Z Z X X Keyframing ACM © 1987 “Principles of traditional animation applied to 3D computer animation” s(t ) Describe motion of objects as a function of time from a set of key object positions. In short, compute the inbetween frames. Key frames • Compute first a small number of key frames • Interpolate the remaining frames in-between these key frames (in-betweening) • Key frames can be computed – at equal time intervals – according to some other rules – for example when the direction of the path changes rapidly In-betweening • The simplest method of in-betweening is linear interpolation • Interpolation is normally applied to the projected object points 1’ 1 3’ 3 added point 2’ 2 Key frame k Halfway frame Key frame k+1 In-betweening - example • Given coordinates of a 2D point – key frame n: (xn,yn) – key frame n+1: (xn+1,yn+1) – time interval between the two key frames: 1/10 second • To get smooth animation, needs at least 30 frames per second • Solution: insert at least further 2 frames between the given two key frames Keyframes and In-Betweening Before In-betweens After Calculating in-between frames using linear interpolation x = (xn+1 - xn) / 3 y = (yn+1 - yn) / 3 for ( i=1; i<3; i++ ) { xi = xn + i * x yi = yn + i * y } Example: Interpolating Positions • Given positions: • find curve (x i , y i ,t i ), i 0, x (t ) C (t ) y ( t ) (x 2 , y 2 , t 2 ) C (t ) such that ,n x i C (t i ) y i ( xu0 , y 0 , t 0 ) (x 1 , y 1 , t 1 ) 0 Linear Interpolation (x 2 , y 2 , t 2 ) (x 0 , y 0 ,t 0 ) (x 1 , y 1 , t 1 ) • Simple problem: linear interpolation between first two points assuming t 0 =0 and t 1=1 : • The x-coordinate for the complete curve in the figure: x (t ) x 0 1 t x 1t Linear Interpolation • Two Problems with Linear Interpolation – Unnatural movement • Nothing really moves like this – motion begins and ends instantaneously, with objects attaining their full velocity as soon as they start to move, and maintaining it until they stop. • Solution: using hand-made animation Polynomial Interpolation (x 2 , y 2 , t 2 ) (x 0 , y 0 ,t 0 ) (x 1 , y 1 , t 1 ) parabola • An n-degree polynomial can interpolate any n+1 points. The Lagrange formula gives the n+1 coefficients of an n-degree polynomial that interpolates n+1 points. The resulting interpolating polynomials are called Lagrange polynomials. Easing In • The object accelerate from a standstill to its final velocity. (Hodkins, http://www.cc.gatech.edu/classes/cs8113a_98_spring/principles.pdf) (Hodkins, http://www.cc.gatech.edu/classes/cs8113a_98_spring/principles.pdf) Rigid body animation • Rigid body animation uses standard 3D transformations • At least 30 frames per second to achieve smooth animation • Computing each frame would take too long (Hodkins, http://www.cc.gatech.edu/classes/cs8113a_98_spring/principles.pdf) Robotic Arm Example • • • • Fingers first Then wrist Then elbow Finally, shoulder Robotic Arm Example y R2 T2 R1 T1 T3 R3 T4 P x Find the new location of P (P’) after some translations T1, T2, T3, T4 and rotations R1, R2, and R3. Express in terms of a matrix product, i.e. P’ = R1R2R3P Robotic Arm Example y P’ P T4 P’ = T4P x Robotic Arm Example y P’’ = R3P’ = R3T4P P’ R3 P’’ x Robotic Arm Example y P’’’ P’’’ = T3P’’ = T3R3T4P T3 P’’ x Robotic Arm Example y P’’’ P4 = R2P’’’ = R2T3R3T4P R2 P4 x Robotic Arm Example y P5 T2 P4 P5 = T2P4 = T2R2T3R3T4P x Robotic Arm Example y P5 R1 P6 P6 = R1P5 = R1T2R2T3R3T4P x Robotic Arm Example y P7 T1 P6 P7 = T1P6 = T1R1T2R2T3R3T4P x Robotic Arm Example y R2 T2 R1 T1 T3 R3 T4 P7 T1 P6 P7 = T1P6 = T1R1T2R2T3R3T4P x Robotic Arm Example y R2 T2 R1 T1 T3 T4 P7 R3 x P7 = T1P6 = T1R1T2R2T3R3T4P 3D Transforms Pretty much exactly the same as 2D transforms y y x z T T x Physically Based Animation • Assign physical properties to objects (masses, forces, inertial properties) • Simulate physics by solving equations • Realistic but difficult to control v0 m g Topics in Animation • Scripted Animation – Keyframe interpolation, articulated models, inverse kinematics, deformations, … • Procedural Animation – Particle Systems, Flocks, Crowds, Cloth, Fire, Smoke, Water, … • Motion capture – Filtering, editing, retargeting, stitching,… 76 Procedural animation • describes the motion algorithmically • express animation as a function of small number of parameters • Example: a clock with second, minute and hour hands – hands should rotate together – express the clock motions in terms of a “seconds” variable – the clock is animated by varying the seconds parameter Procedural animation 78 Scripted Animation 79 Motion capture 80 Motion Capture • Usually uses optical markers and multiple high-speed cameras • Triangulate to get marker 3D position • Faces or joints • You must observe someone do something (Hodkins, http://www.cc.gatech.edu/classes/cs8113a_98_spring/) Quiz • I sat in the car, and realized the side mirror is 0.4m on my right and 0.3m in my front • I started my car and drove 5m forward, turned 30 degrees to right, moved 5m forward again, and turned 45 degrees to the right, and stopped • What is the position of the side mirror now, relative to where I was sitting in the beginning?