Pixar: The math behind the movies – Tony DeRose

Pixar: The math behind the movies – Tony DeRose

Pixar: The Math Behind the Movies – Tony DeRose

At Pixar, we’re all about telling stories, but one story that hasn’t been told very much is the huge degree to which math is used in the production of our films. The math that you’re learning in middle school and high school is used all the time at Pixar.

Believe it or not, you just saw a ton of mathematics. Where is it? Well, to explain that, it’s important to understand that artists and designers think in terms of shape and images, but computers think in terms of numbers and equations. So, to bridge those two worlds we use a mathematical concept called coordinate geometry. That is, we lay down a coordinate system with x describing how far something is to the right and y describing how high something is. So, with these coordinates, we can describe where Woody is at any instant in time. For instance, if we know the coordinates of the lower left corner of that image, then we know where the rest of the image is. And in that little sliding animation we saw a second ago, that motion we call translation, the x coordinate started with a value of one, and it ended with a value of about five.

So, if we want to write that in mathematics, we see that the x at the end is four bigger than x at the start. So, in other words, the mathematics of translation is an addition. How about scaling? That is making something bigger or smaller. Any guesses as to what the mathematics of scaling might be? Dilation, multiplication, exactly. If you’re going to make something twice as big, you need to multiply the x and the y coordinates all by two.

So, this shows us that the mathematics of scaling is multiplication. What about rotation? The mathematics of rotation is called trigonometry. It looks a little scary at first. You’ll probably get this in eighth or ninth grade. If you find yourselves sitting in trigonometry class wondering when you’re ever going to need this stuff, just remember that any time you see anything rotate in one of our films, there’s trigonometry at work underneath. I first fell in love with mathematics in seventh grade. My seventh-grade science teacher showed me how to use trigonometry to compute how high the rockets that I was building was going.

I just thought that was amazing, and I’ve been enamored with math ever since. So, this is kind of old mathematics. The Mathematics that’s been known and, you know, developed by the old dead Greek guys. And there’s a myth out there that all the interesting mathematics has already been figured out. But the real story is that new mathematics is being created all the time. And some of it is being created at Pixar.

The thing to notice about the characters of Pixar is they’re really complicated. Those shapes are really complicated. In fact, the toy cleaner, I have an example, the toy cleaner there in the middle, here’s his hand. You can imagine how fun it was to bring this through airport security. His hand is a complicated shape. It’s not just a bunch of spheres and cylinders stuck together. And not only is it complicated, but it must move in complicated ways. So, I’d like to tell you how we do that and to do that I need to tell you about midpoints.

So, here’s a couple of points, A and B, and the line segment between them. We’re going to start out first in two dimensions. The midpoint, M, is the point that splits that line segment in the middle. So, that’s the geometry. To make equations and numbers, we again introduce a coordinate system, and if we know the coordinates of A and B, we can easily compute the coordinates of M just by averaging. You now know enough to work at Pixar. Let me show you. So, I’m going to do something slightly terrifying and move to a live demo here. So, what I have is a four-point polygon here, and it’s going to be my job to make a smooth curve out of this thing.

And I’m going to do it just using the idea of midpoints. So, the first thing I’m going to do is an operation I’ll call split, which adds midpoints to all those edges. So, I went from four points to eight points, but it’s no smoother. I’m going to make it a little bit smoother by moving all these points from where they are now to the midpoint of their clockwise neighbor. So, let me animate that for you. I’m going to call that the averaging step. So, now I’ve got eight points, they’re a little bit smoother, my job is to make a smooth curve, so what do I do? Do it again. Split and average. So, now I’ve got sixteen points. I’m going to put those two steps, split and average, together into something I’ll call subdivide, which just means split and then average. So, now I’ve got 32 points. If that’s not smooth enough, I’ll do more.

I’ll get 64 points. Do you see a smooth curve appearing here from those original points? And that’s how we create the shapes of our characters. But remember, I said a moment ago it’s not enough just to know the static shape. We need to animate it. And to animate these curves, the cool thing about subdivision. This idea of splitting and averaging also holds for surfaces. So, I’ll split, and I’ll average. I’ll split, and I’ll average. Put those together into subdividing, and this how we create the shapes of all our surface characters in three dimensions. So, this idea of the subdivision was first used in a short film in 1997 called Geri’s Game. And Geri made a cameo appearance in Toy Story 2 as the toy cleaner. Each of his hands was the first time we ever used subdivision.

His face was a subdivision surface, so was his jacket. Since that time, we’ve built all our characters this way. So, here’s Merida, the lead character from Brave. Her dress was a subdivision surface, her hands, her face. The faces and hands of all the clansman were subdivision surfaces. Today we’ve seen how addition, multiplication, trigonometry, and geometry play a role in our films. Given a little more time, I could show you how linear algebra, differential calculus, integral calculus also plays a role. The main thing I want you to go away with today is to just remember that all the math that you’re learning in high school and college we use all the time, at Pixar.

As found on Youtube

Pixar: The math behind the movies – Tony DeRose Pixar: The math behind the movies – Tony DeRosePixar: The math behind the movies – Tony DeRose