# Finding Dory’s Math

Dory, the blue tang ﬁsh introduced in the animated hit *Finding Nemo*, is all alone, and she's swimming next to the number 135.1 million. This is the amount her new movie Finding Dory tallied in North American theaters during its opening weekend, which set the record and moved *Shrek the Third* to second place.

Pixar ﬁlms begin as storyboards, like the sketch just below and to the left, which was one of 103,000 drawn for the ﬁlm. The sketches are placed side-by-side in sequence in order to convey scenes and deliver a rough sense of how the story unfolds. The story artists play an important role in pre-visualizing the ﬁlm. The magic of Pixar goes from the storyboards to the ﬁnal images, as seen in the image below and to the right. Let's explore the fundamental role that mathematics plays in bringing animated characters like Dory to life.

A critical stage in Pixar's animation involves representing a character as wireframe meshes in a computer, as seen below and to the left. Moving from the wireframes to the smooth characters, seen in the image below and to the right, was a monster breakthrough in animation. An important step in this process uses weighted averages. Let's see how Pixar utilizes such math as part of its animated storytelling movie magic!

Pixar's short ﬁlm *Geri's Game* (1997) demonstrated its weighted average-based subdivision technique, which continues to be used in Pixar ﬁlms today. Subdivision smooths a wireframe mesh, visible in Geri's hand below on the left, by subdividing each polygonal face of the mesh into smaller and smaller faces. This method gives the appearance of a smooth surface, visible below on the right.

To understand subdivision, let's see how the process works in 2D. We'll begin with a square, as seen below and to the left. Then we ﬁnd the midpoint for each line segment, which is in fact the average of the two endpoints of the line segment. This step is called *split*, as seen in the square with the black circles below and to the right.

Next, we replace the original vertices of our square with points found by a weighted *average*. To start, we'll use a **1-1** weighted average, also known as the 1-1 rule. That is, our original vertices and midpoints are each given the same weight. In the clockwise direction, we replace each vertex of our square with the average of its value and the next midpoint. This creates a *subdivision* of our original polygon, now with eight points, as seen below and to the left.

We can repeat this process. We *split* the new line segments to ﬁnd the midpoints, then in the clockwise direction we replace each vertex of our current polygon with an *average* of the vertex and the next midpoint. If we continue to loop through this process, we get a smoother polygon via *subdivision*, as seen in the image to the right. This is precisely how Pixar goes from a coarse wireframe to a smooth model, only they do it in 3D instead of 2D, as with Geri's hand.

Want to try it yourself? Visit the subdivision web app and you can. You can try other weights with the web app, so let's try a **1-2-1** weighted average, or the 1-2-1 rule. That is, we take the average of the two adjacent midpoints for each vertex, one in each of the clockwise and counter-clockwise locations, along with two parts of the vertex's location itself. Repeated applications of the 1-2-1 rule produces the image on the left.

This looks pretty similar to what we produced with the 1-1 rule, as both result in smooth images. Be careful, though; not all coefﬁcients are the same. Consider using the **1-(-2)-3** rule, where we take 1 part of the counter-clockwise neighbor, -2 parts of the vertex itself, and 3 parts of the clockwise neighbor, as indicated in the rule. On a square, you get the image above and on the right after a few applications. This rule results in a "curve" which is nowhere smooth.

So, how do you know what to use? If you want something that is guaranteed to be smooth, take a row of Pascal's Triangle. Thus far we've tried 1-1 and 1-2-1. So, **1-3-3-1** is another option. If you’re interested in more of the math behind the coefﬁcients, see the article *Pixar's Linear Algebra* by Borland, Chartier, and Peck on pages 15-18 in the spring 2016 issue of *IMAGE*. Now it is your turn to experiment in your own mathematical studio. Visit the subdivision web app, and try your own coefﬁcients.

Tim Chartier is an associate professor of mathematics and computer science at Davidson College. He received a national teaching award from the Mathematical Association of America and has worked with Google and Pixar on their educational initiatives. |