SIAM News Blog
SIAM News
Print

Finding Dory’s Math

By Tim Chartier

Dory, the blue tang fish 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.

© Disney/Pixar, used with permission

Pixar films begin as storyboards, like the sketch just below and to the left, which was one of 103,000 drawn for the film. 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 film. The magic of Pixar goes from the storyboards to the final 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.

© Disney/Pixar, used with permission

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!

© Disney/Pixar, used with permission

Pixar's short film Geri's Game (1997) demonstrated its weighted average-based subdivision technique, which continues to be used in Pixar films 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.

© Disney/Pixar, used with permission

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 find 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 find 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 coefficients 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 coefficients, 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 coefficients.

  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. 

 

blog comments powered by Disqus