Animation Module No: CS/CGV/20
Total Page:16
File Type:pdf, Size:1020Kb
MODULE - 20 e-PG Pathshala Subject: Computer Science Paper: Computer Graphics and Visualization Module: Animation Module No: CS/CGV/20 Quadrant 1– e-text Objectives: To understand the basic terminology of animation To understand the principles behind popular techniques of animation Discussion: Animation in simple terms is ‘any time sequence of visual changes in a scene’. Visual changes may be – basic transformations like translation, rotation, scaling, transparency, surface texture, shape, color, etc. When a series of images are played at quick succession, the effect is an animation. Frame rate defines the number of frames played in a second. With the advent of animation software, it has become easier for animators to design, implement and test animation sequences. The software offers a rich set of ready-made functionalities to create interactive rich, smoother animation sequences in short time. The master animators define the important frames / key frames and the software automatically interpolates the desired frames. Animation is fundamentally computer created. Animation sequences can be either 2D or 2 ½ D or 3D or 4D. 2D animation involves simple 2D images and they are played in succession at the desired frame rates. 2 ½ D animation is an extension of 2D animation, in which a feel of 3D is created in 2D. 3D animation adds the 3rd dimension to give a feel of real world objects. In 4D other special effects are added to a 3D animation sequence like, smell, touch, environment, etc.. There are four stages to create an animation. They are Storyboard layout Object definitions Key-frame specifications Generation of in-betweens A storyboard is a visual / graphical layout of an animation. It gives us a preview of the actual animation. Then properties and behaviour for each of the objects is defined. The properties include, dimension, position, color, texture, shape, etc..The behaviour is the role attached to the object or animation character. The behaviour defines, how an object should respond when an event occurs. Later Key-frames are defined by the master animator to tell the software that the other frames are to be computed by it automatically by assuming key-frames as reference. Key-frames are the important frames where there is a considerable change in the course of animation. Once these frames are defined, the software automatically interpolates the frames between two key frames. The automatic generation of in-betweens is called tweening. Frame rate is an important attribute of animation. Animations that involve rapid action sequences require higher frame rates for a smoother, jerk-free animation. Frame rates for animation start at a minimum of 12 fps, and can go up to any higher value. Once the frame rates are decided, the same if applied for an entire animation sequence. The following are some of the common techniques of animation. Frame by Frame Key-frame Onion Skinning Rotoscoping Squash and Stretch Path-Based (Sprite) Secondary action Morphing Motion Capture Kinematics Frame-by-Frame animation: In this technique each individual frame is separately edited and when played back in quick succession, we experience animation. Key-frames and Tweening: In this technique as described earlier Key frames are defined by the master animator, and the software automatically interpolates the in-betweens in the process called tweening. The number of in-betweens is decided by the frame rates required. The interpolation may be linear or non- linear. In linear interpolation, the objects position is interpolated along a straight line between two key-frames. In non-linear interpolation, the objects path may be interpolated along curves for smoother and realistic animation. Onion skinning: In this, onion skinned versions (semi-transparent) of a few previous positions of an object are shown so as to enable correct positioning of the object in the current frame. Often it is required to know the previous position of an object, to determine the correct current position for the desired animation sequence. It is sufficient to show onion skinned versions of two or three previous frames for editing the current frame. Since the immediate previous frame is important, its near opaque version is provided, and progressively the opaqueness is reduced for the other previous frames. Squash and Stretch: In this technique, the objects’ shape is squeezed / stretched as per requirement. This effect is desired to give the audience a feeling that the object is fast approaching a point or about to hit a point and also imitates objects that have elastic properties. The figure below shows the effect for a ball, as it approaches a firm obstruction it gets squeezed and when it re- bounces it gains its shape back and gets stretched. Morphing: Morphing is another interesting technique that is used to perform transformation between two different shapes. This is sometimes referred to as ‘shape-tweening’. Here we choose an initial shape in the first key frame and final shape in the second key-frame and the software automatically interpolates the possible in-between shapes depending on the number of frames / frame-rate prescribed, which is shown in figure below. It is not possible to perform morphing from between any two random shapes. It is made possible if the number of vertices that define the objects (initial and the target) match, i.e. both the objects should have been defined with the same number of vertices. The example below shows, two key frames, key-frame k and key-frame k+1. Keyframe k has two vertices, while keyframe k+1 has three vertices. Now to perform morphing between these two shapes we should ensure that both these shapes are defined with the same no. of vertices. The solution is to add an extra vertex to an edge of the initial shape and interpolate to form the new shape. Another example below shows a triangle to be morphed to a quadrilateral. The suitability of two shapes involved in morphing can be checked either at the vertex level or at the edge level for such standard shapes. vertex: Let Vk and Vk +1 denote the number of vertices in the two consecutive frames. Define Vmax=max(Vk , Vk +1), where Vmax identifies the maximum no. of vertices among the two. Vmin=min(Vk , Vk+1) where Vmin defines the minimum no. of vertices among the two Nls=(Vmax -1)mod (Vmin-1) , where Nls defines the number of line segments Np = int (Vmax -1) / (Vmin -1) , where Np defines the number of vertices to be added The two simple steps of the procedure to add the desired no. of vertices is given below. Add Np points to Nls line sections of keyframemin Add Np-1 points to the remaining edges of keyframemin. For example If Vk=3, and Vk+1=4, Nls= Np=1. So add one point to one edge of keyframe k. No points would be added to remaining edges of keyframe k. The above figures show acceleration and decceleration modeled using trigonometric functions. Acceleration is modeled by a function and the corresponding in-between spacing is adjusted as per the function. The second figure above, shows deceleration function and the corresponding in-between spacing. The figure above (left) shows how to combine acceleration and deceleration functions, and the corresponding spacing. The figure above (right) shows approximating the motion of a bouncing ball with a damped sine function. The path that should guide the object can be either formed using mathematical function or can be drawn. This kind of animation is sometimes called as path-based animation or sprite animation. Kinematics and dynamics: Kinematics is imitating human like motion. Here the human like motion is superimposed on artificially modeled characters to achieve this effect. As shown in the figure below, the human hands, legs and body have various joints, and the movement involves bending at the joints and take motion. This motion can be created in two ways, either by using forward kinematics or by using Inverse kinematics. Forward Kinematics: This refers to the use of the kinematic equations of a robot to compute the position of the end- effector from specified values for the joint parameters. The figure below shows an illustration of a robotic arm, with one end stuck to the base and the free other end called the end-effector, whose position is to be decided whenever we want it to make some movement. To make the end-effector position itself exactly for a task, we adjust the angles of the shoulder, elbow extension, arms of the device. The animator specifies joint angles say θ1, θ2 etc., and the computer finds the positions of the end-effector say X. Inverse Kinematics: The reverse process that computes the joint parameters that achieve a specified position of the end-effector is known as inverse kinematics. Here the animator Specifies end-effector positions: X and the computer finds joint angles: θ1 and θ2. This is called goal-directed motion. Motion Capture: This is a technology where the data corresponding to the performances of actual real world characters are superimposed on characters artificially created using computers. The real world characters perform on a systematically positioned stage, which is captured by many Infrared cameras surrounding the performer. At various joints of the performer body, reflective objects are stuck, so that the reflected beam is recorded by the infrared cameras. At any point in time during the performance, information from 3 cameras is recorded and stored in a file. This data is later applied onto the modeled characters to achieve an exact imitation of real characters. This technology is less used since the cost of installation and operational requirements are quite high. Summary: Learnt techniques of animation .