# Animation: From Fantasy to Reality

## Animation and its development: A Brief Overview

An absolutely adorable scene from Pixar’s Toy Story.

Though animation may have come to the forefront of entertainment only in the 20th century, it has been around for a pretty long time. The first pieces of  animation date back to as far as the 1500s. For instance, Leonardo da Vinci’s Vitruvian Man  depicts multiple angles, implying movement. After that a series of inventions followed, that transformed animation. The first of these inventions was the Magic Lantern, which is considered the first example of projected animation.Then followed a cascade of contraptions in the 18th century: the thaumatrope, the phenakistoscope, and the praxinoscope.

This slideshow requires JavaScript.

With further development of technology the Silent era of the 1900s arrived. The scene was then taken up by the well-famed Walt Disney, who introduced mickey mouse and his familiar friends to us. Soon the animation industry began gaining traction in the American households heralding the golden age of American animation. Theatrical cartoons then became an integral element of the popular culture. The Warner Brothers, MGM, Fleischer and many other animation studios popped up with the chief aim of entertaining the child in us.

From the classic The Flintstones TV series to The Simpsons to Toy Storyanimation has come a long way. Today animation stands at something like par with the live action movies in terms of the visual effects and continuity in video. It continues to grow and shows potential to even outdo the shriveling industry of live action films. Animation’s success may have to do with its  ability to communicate didactic plots without the threat of becoming overtly sententious. And then the clincher: it has the support of the toddlers!

### Animation’s reason for progress?

Even after new inventions in technology have stopped, animation continues to develop. How does this growth persist?

New Mathematics continues to be created and so the systems which rely on Mathematics  become more efficient over time. As new techniques of tackling problems are discovered, old ways of doing things are discarded and new, more refined ways are adopted. This process of amelioration happens more often than it seems due to the astonishing connections that can be made in Mathematics to solve a problem.  The importance of Mathematics’ highly applicable nature cannot be overstated as we shall soon see its role in the creation of animation.

Animation stands at the rich crossroads of Art, Science and Mathematics. Each of these elements is of great import in developing  animation that is fantastic yet realistic enough to be believable. Art provides the touch of creativity, importing to animation a gamut of human emotions: despondency, elation, melancholy, outrage… For any piece of creativity to be successful, it should be able to connect with the audience; art in animation plays that  role of the matchmaker. Science supplies the laws of the nature and if animation has to be realistic, it must generally abide by these rules.

### Mathematics’ role in the whole deal?

For a particular scene, after having worked out the general qualitative motion of the character(s) between the first and last frame according to the laws of physics, how do you feed your animation into the computer? One way is to use the Straight Ahead technique. This is simple: you create a series of handmade cartoons to outline the desired scene; you scan these sketches into the computer and then you let the computer run the series of sketches in quick succession and- voila! – you have created a basic piece of animation.

A series of sketches superimposed to create the effect of a film

Though this method of animation is quite effective, it is clear that Straight Ahead technique of animation cannot be used to create the modern gems of animation. It cannot posssibly reflect the several nuances and subtleties invloved in complex movements such as the fluttering of Superman’s cape or the ripples caused in the water when Nemo cuts through it. Therefore the need for a more powerful animation technique is felt. This is where Mathematics comes in. Mathematics enables animators to translate their imagination from paper to the computer without having to compromise on artistic details. Computers were built to be masters at comprehending the language of numbers and so Mathematics establishes an interface between the animator and the computer utilizing this ability.

Animation extensively uses coordinate geometry, function graphs, subdivision surfaces, calculus, harmonic coordinates, Laplace’s equation,… and the list just gets exponentially scarier. Out of these, the role of coordinate geometry is especially important.

When you have created your object on the paper, how do you describe it in a manner which is intelligible to a computer? The fact that any character is essentially an aggregate of points in space can be used to give a numerical description of the object. If the character is two dimensional, each point in space occupied by it can be denoted by its cartesian coordinates. Therefore each point occupied by the object can indeed be given a very specific mathematical interpretation, which would be easily understood by a computer. The same method can be extended to a 3-D object; each point occupied will be represented by its Cartesian coordinates in the three planes X, Y, and Z.

Having given such specific description of the object, animators can then manipulate the object at extremely minute levels with the right mathematical techniques and software(like Autodesk Maya). When the computer is introduced into the frame, it is found, quite expectedly, that manual labour goes down significantly. Earlier a series of sketches had to be prepared(in Straight Ahead animation) to achieve a complete scene, but now only a few “key poses” in the scene have to manually described. The rest is filled in by virtue of the  computer’s omnipotence through a process called linear interpolation. In linear interpolation, the computer forms an equation of the line passing through the start and end point coordinates provided to it and then fills in the intermediate points based on this equation.

### Describing motion and its intricacies

Suppose you had to animate a bouncing ball being released from someone’s hands, the starting step would be to describe the “key poses” : the position of the ball at the instant at which it is dropped (t=0 seconds) and the position of the ball just before it hits the ground (say t=5 seconds; this will depend on the height from which you choose to drop the ball, in this case the height would be roughly 123m).

Ball at t=0 & 5s

For this situation, the computer will(due to linear interpolation) assume the following to be the equation of the distance-time graph of the ball :

$\textbf{123x - 5y = 0}$ .

Subsequently, the software will fill in the frames between time t=0 and t=5. However, the software will assume that the position of the ball with respect to time is changing linearly and thus fills in the in-between-frames accordingly. Therefore at t = 2.5 s, the software will show that the ball would be halfway(i.e, 123/2 = 61.5m above ground) between the dropping point and ground.However if you work out the physics, it turns out that at t = 2.5s the ball would be at a height of about 92 m from the ground. This is simply because of the software assumes that the velocity of the will be constant, which is false since the force of gravity causes acceleration($\frac{\textbf{ d}v}{\textbf{ d}t} \neq 0$). To solve this problem, you can give the software a graph representing the desired motion of the ball.

Distance-time graph of the falling ball. It is a parabola with the equation $y = 4.9 x^2$.

After the software is provided with the above graph, the motion of the ball will look more natural since it is now in accordance with the laws of physics. With this the animation of a bouncing ball is ready!

Similarly graphs can be provided to describe how other factors related to the object and its surrounding change with respect to time. For instance you can define graphs to describe how the dimensions, speed and maybe even weight change with respect to time. The curves of such graphs are known as Bezier Curves.

### How Pixar fabricated Geri’s hand

Earlier we had seen that by scanning our character from the paper and feeding it into the computer, we can manipulate it to do a variety of things. However this yields rough surfaces since the character is stitched together from a combination of geometrical shapes. To achieve smooth surfaces animators use subdivision surfaces. I will briefly describe this relatively new technique (in fact, it was first developed by Edwin Catmull, incumbent president of Pixar in 1978) .

The process of subdividing a surface entails two mathematical processes: splitting and averaging. Say you are given four points  which are joined to make a quadrilateral ABCD. For a quadrilateral the averaging step would be to mark the midpoints of all sides, say E, F, G and H (shown below).Then in the second step, you take the midpoints of the segments AF, FD, DG and so on. When we connect the points we got in the last step, we obtain a figure that is “smoother” than the starting figure ABCD.

These two steps combined into one is called the subdivision step. If we perform the subdivision step even a small number of times what we get is both impressive and surprising.

Result after the subdivision process is repeated.

This process results in curves which can be used to generate smooth surfaces. The same process can be applied to 3-d objects like a cube or ring to obtain a sphere or a doughnut. Subdivision can be applied in a variety of more complex ways to achieve the marvels of today’s animation. Pixar first used the process of subdivision in “Geri’s Game“(1978) to give a smooth perception to Geri’s hand. It is therefore evident that subdivision surfaces help to give the characters a real-life feel, providing a more refined experience to the viewer.

Geri’s hand before and after subdivision

Another important component in bringing a character to life is making its motion as natural as possible. This of course relies heavily on physics but mathematics too supplies some handy tools to simplify the situations.

### The relationship between spinning Buzz and Trigonometry

Rotation is a major constituent of motion, however it can sometimes become quite complex.To simplify rotational scenarios, animators apply the branch of maths which establishes a relation between angles and lines, trigonometry. Suppose you know the coordinates of point A at t = 0s is (5,0), then what will the position of point A after it is rotated by an angle of 45°(counterclockwise) to point A’?

If we drop a perpendicular A’X from A’ to the X-axis, then using the basic concepts of trigonometry, we can derive the coordinates of A’ in terms of A and α.

Since the length of BA will remain unchanged after rotation, BA’ = BA = 5.In triangle BXA’, since $\angle$BXA’ = 90° we have :

$\textbf{a} = 5 \times \textbf{cos}(\alpha) = 5 \times \textbf{cos}(45) \approx 3.54$

$\textbf{and, }$ $\textbf{b} = 5 \times \textbf{sin}(\alpha) = 5 \times \sin(45) \approx 3.54$

Hence we have obtained A’ $\equiv$(3.54 , 3.54).

In more general terms, if a point P(m,0) is rotated by an angle θ in the counterclockwise direction then the new coordinates of P'(h,k) are given by :

$\textbf{h} = \textbf{m} \times \textbf{cos}(\theta)$

$\textbf{and, }$ $\textbf{k} = \textbf{m}\times\textbf{sin}(\theta)$

Using these results in combination with the trigonometric compound angle formula, it can be shown that if a point R(x,y) is rotated through an angle of θ in the counterclockwise direction, the new point R'(x’,y’) will have the following coordinates:

$\textbf{x'} = \textbf{x} \textbf{cos}(\theta) - \textbf{y} \textbf{sin}(\theta)$

$\textbf{and, }$ $\textbf{y'} = \textbf{x} \textbf{sin}(\theta) + \textbf{y}\textbf{cos}(\theta)$

Using this, animators can exactly predict where each particle will go after a given rotation. It thus allows animators to handle rotational motion scenarios in a much easier fashion. This application of trigonometry can be used to represent rotation even in 3-d cases.

## The Color on the Animator’s canvas

In our thrilling experiences of watching animation, a very important role is played by color. A question worth considering is that how is each of the pixels colored the way it is in every single scene? Or in technical terms, how is the screen rendered for each scene in the movie? There are a variety of ways to achieve it and some of the more complex ones involve the advanced ideas of calculus and probabilistic distribution. A powerful yet simple way to render the object image onto the screen is to use the process of ray tracing which uses algebra to do the magic. I will briefly outline this process.

Suppose that we are given the task of rendering a colored 2-D object onto the screen. The colored 2D object to be rendered is shown in the diagram below by the line segment $\overline{AB}$. The image has to be rendered on the image line which is represented by the line segment, $\overline{A'B'}$. Therefore our basic aim is to find the color of each of the points lying on $\overline{AB}$ as seen from the camera C.

Let’s consider the point P’ on $\overline{A'B'}$. To find the color at point P’, we can draw a line through the points C and P’ and let the line intersect AB at point P. Since P’ is an image of P, it will have the same color as point P. Therefore to find the color at point P’, it will suffice to find the color at point P. We have the following data : C≡(a,b), P’≡(c,d), A≡(p,q) & B≡(r,s). From this the coordinates of P have to be found.

Parametric equation of line CP'(taking t as the parameter variable):

$\textbf{R} \left(t \right) = \left (1- \textbf{t} \right) \textbf{C} + \textbf{tP'}$

Equation of line AB:

$\left( \textbf{q - s} \right) \textbf{x} + \left( \textbf{r - p} \right)\textbf{y} = \textbf{rq - sp}$

Assume P$\equiv$ (h,k). Now, since point P lies at the intersection of the lines CP’ and AB, it satisfies the following three equations:

$\textbf{P}_x = \textbf{R}_x(\textbf{t}_\textbf{P}) = \textbf{C}_x(1- \textbf{t}_\textbf{P} ) + \textbf{P'}_x\textbf{t}_\textbf{P}$

$\textbf{or, } \textbf{h} = \textbf{a}(1- \textbf{t}_\textbf{P}) +\textbf{c} \textbf{t}_\textbf{P}$

$\textbf{Similarly, } \textbf{k} = \textbf{b}(1- \textbf{t}_\textbf{P}) + \textbf{d} \textbf{t}_\textbf{P}$

$\text{And, } \left( \textbf{q - s} \right) \textbf{h} + \left( \textbf{r - p} \right)\textbf{k} = \textbf{rq - sp}$

Therefore we now have three equations in three variables $\textbf{t}_\textbf{P}$, h and k which can be solved to give the value of h and k. Since we now have the coordinates of point P, we know the color at point P and thus the color at point P’.

You guessed it: this procedure of ray tracing can be extended to render a 3D object. I have again described the process in an abridged manner.

Before extending ray tracing to 3D objects, it would be important to observe the nature of how 3D objects are constructed. Any 3D object is essentially constructed by a combination of small triangles, the simplest polygons, stitched together. Therefore the surface of any 3D character can be described as a collection of smaller triangles.

Examples of 3D solids with triangles as the basic unit

So if we are able to extend the method of ray tracing to triangles then we will be able to render images of 3D objects by repeatedly applying ray tracing on each of the constituent triangles of an object.

In the image below the constituent triangle is shown in red color. Since the number of dimensions to be considered has increased by one( object has become 3D), the image will now be formed on a  plane(as opposed to a straight line), which is shown in blue color. We have the following data: C$\equiv$(a,b,c), P’$\equiv$(p,q,r) and vertices of $\bigtriangleup \text{LMN}$ : $\text{L} \equiv (\text{a}_1,\text{b}_1,\text{c}_1$),$\text{M} \equiv (\text{a}_2 , \text{b}_2,\text{c}_2)$ and $\text{N} \equiv (\text{a}_3 , \text{b}_3,\text{c}_3)$. The coordinates of point P have to be found to find the color at point P’.

Parametric equation of line CP’ is:

$\textbf{K}(\textbf{t}) = \textbf{C}(1 - \textbf{t}) + \textbf{P't}$

which has hidden within it three equations[taking the coordinates of P≡(h,k,j)] :

$\text{P}_x =\textbf {h} = \textbf{a}(1 - \textbf{t}) + \textbf{pt}$,

$\textbf{P}_y = \textbf {k} = \textbf{b}(1 - \textbf{t}) + \textbf{qt}$, and

$\textbf{P}_z = \textbf {j} = \textbf{c}(1 - \textbf{t}) + \textbf{rt}$.

And the equation of the plane on which $\bigtriangleup \textbf{LMN}$ lies is:

$(\textbf{x-a}_3)(\textbf{b}_1\textbf{c}_2 - \textbf{c}_1\textbf{b}_2) + (\textbf{y-b}_3)(\textbf{c}_1\textbf{a}_2 - \textbf{a}_1\textbf{c}_2) + (\textbf{z-c}_3)(\textbf{a}_1\textbf{b}_2 - \textbf{b}_1\textbf{a}_2) = 0$

Thus by solving these four equations the coordinates of P≡(h,k,j) can be calculated which allows the color at point P and consequently the color at point P’ to be determined.The above procedure was briefly the outline of what ray-tracing entails. This procedure is repeatedly performed by the computer for each point on the surface of the object to generate the vibrant shades that serve to tell tonnes about the story and its characters.

### Maths in Animation: a Teleporter

From the above examples and more such instances, it is not difficult to see that Mathematics is the sole component of animation that helps Pixar, Disney , DreamWorks and countless others to produce their cinematic feats which were at most stuff of dreams back in the 1800s. Animation with all its vibrance and effervescence would never have come into its present brilliant form without incorporating the Math which supplies animators with tools to delineate motion and the surroundings in which the action takes place. But most important of all, Math brings to life the flat characters from the paper by transporting them to the untrammeled and lively digital realm. So is the role of Mathematics in an animated film fulfilled!