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.

So, let’s start with a very simple example.

Anybody recognize this guy? (Cheers)

Yeah, so this is Woody from Toy Story,

and let’s ask Woody to, say, walk across the stage

from, say, left to right, just like that.

So, 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, right?

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 addition.

Alright?

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 mulitply the x and the y coordinates

all by two.

So, this shows us that the mathematics of scaling

is mulitiplication.

Okay?

How about this one?

How about rotation? Alright, spinning around.

The mathematics of rotation is trigonometry.

So, here’s an equation that expresses that.

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.

Any seventh graders? A few of you? Yeah.

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.

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,

in fact all of mathematics has 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.

So, I’d like to give you an example of that.

So, here are some characters

from some of our early films:

Finding Nemo, Monsters Inc. and Toy Story 2.

Anybody know who the blue character in the upper left is?

It’s Dory. Okay, that was easy.

Here’s a little harder one.

Anybody know who’s the character in the lower right?

Al McWhiggin from Al’s Toy Barn, exactly.

The thing to notice about these characters

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 really complicated shape.

It’s not just a bunch of spheres and cylinders stuck together, right?

And not only is it complicated,

but it has to 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, right?

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 of 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 charcters.

But remember, I said a moment ago

it’s not enough just to know the static shape,

the fixed shape.

We need to animate it.

And to animate these curves,

the cool thing about subdivision.

Did you see the aliens in Toy Story?

You know that sound they make,

“Ooh”? Ready?

So, the way we animate these curves

is simply by animating the original four points.

“Ooh.”

Alright, I think that’s pretty cool,

and if you don’t, the door is there,

it doesn’t get any better than that, so.

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 subdivide,

and this how we actually create the shapes

of all of our surface characters in three dimensions.

So, this idea of subdivision

was first used in a short film in 1997

called Geri’s Game.

And Geri actually made a cameo apperance

in Toy Story 2 as the toy cleaner.

Each of his hands

was the first time we ever used subdivision.

So, each hand was a subdivision surface,

his face was a subdivision surface,

so was his jacket.

Here’s Geri’s hand before subdivision,

and here’s Geri’s hand after subdivision,

so subdivision just goes in and smooths out

all those facets,

and creates the beautiful surfaces

that you see on the screen and in the theaters.

Since that time, we’ve built all of 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 roll in our films.

Given a little more time,

I could show you how linear algebra,

differential calculus, integral calculus

also play a roll.

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 actually up through sophomore college

we use all the time, everyday, at Pixar. Thanks.

在皮克斯,我们都在讲

故事,但一个鲜为人知的故事

在我们的电影制作中大量使用数学。

你在

中学和

高中学习的数学一直在皮克斯使用。

所以,让我们从一个非常简单的例子开始。

有人认识这个人吗? (欢呼声)

是的,这是《玩具总动员》中

的伍迪,让我们请伍迪,比如说,从左到右穿过舞台

,就这样。

所以,不管你信不信,你刚刚看到了大量的数学知识。

它在哪里?

好吧,为了解释这一点

,重要的是要

了解艺术家和设计师根据

形状和图像进行

思考,而计算机则根据数字和方程式进行思考。

所以,为了连接这两个世界,

我们使用了一个叫做坐标几何的数学概念

,对吧?

也就是说,我们制定了一个坐标系,

其中 x 描述某物向右有多远

,y 描述某物有多高。

因此,通过这些坐标,我们可以

描述伍迪在任何时刻的位置。

例如,如果我们知道

该图像左下角的坐标,

那么我们就知道该图像的其余部分在哪里。

在我们在一秒钟前看到的那个小滑动动画中,

我们称之为平移的运动

,x 坐标以 1 的值开始,以

大约 5 的值结束。

所以,如果我们想用数学来写,

我们会看到末尾的

x 比开头的 x 大四。

所以,换句话说,翻译的数学

就是加法。

好吧?

缩放怎么样?

那就是使某些东西更大或更小。

关于缩放的数学可能是什么的任何猜测?

膨胀,乘法,确切地说。

如果要制作两倍大的东西,

则需要将 x 和 y 坐标

全部乘以 2。

因此,这向我们表明,缩放的数学

是乘法。

好的?

这个怎么样?

轮换呢? 好吧,转圈。

旋转的数学是三角学。

所以,这是一个表达这一点的方程式。

乍一看有点吓人。

你可能会在八年级或九年级得到这个。

如果你发现自己坐在三角学课上

想知道你什么时候需要这些东西,

请记住,每当你

在我们的一部电影中看到任何旋转的东西时,

下面都有三角学在起作用。

我在七年级时第一次爱上了数学。

有七年级的吗? 你们几个? 是的。

我七年级的科学老师教我

如何使用三角函数来计算

我正在建造的火箭的飞行高度。

我只是觉得这太棒了,

从那以后我就迷上了数学。

所以,这是一种古老的数学。

众所周知的数学,你知道,

是由死去的希腊老家伙们开发的。

还有一个神话,所有有趣的

数学都已经被弄清楚了

,事实上所有的数学都已经被弄清楚了。

但真正的故事是,新的数学

一直在被创造出来。

其中一些是在皮克斯创作的。

所以,我想给你一个例子。

所以,这里有

一些我们早期电影中的角色:

海底总动员、怪物公司和玩具总动员 2。

有人知道左上角的蓝色角色是谁吗?

是多莉。 好的,这很容易。

这里有一个更难的。

有谁知道右下角的人物是谁?

正是来自 Al’s Toy Barn 的 Al McWhiggin。

关于这些角色需要注意的

是它们非常复杂。

这些形状真的很复杂。

事实上,玩具清洁工,我有一个例子

,中间的玩具清洁工,

这是他的手。

您可以想象

通过机场安检带来的乐趣。

他的手是一个非常复杂的形状。

这不仅仅是一堆粘在一起的球体和圆柱体,对吧?

它不仅复杂,

而且必须以复杂的方式移动。

所以,我想告诉你我们是如何做到这一点的

,为了做到这一点,我需要告诉你关于中点的信息。

所以,这里有几个点,A 和 B,

以及它们之间的线段。

我们将从两个维度开始。

中点 M 是

在中间分割该线段的点,对吗?

所以,这就是几何。

为了制作方程和数字,

我们再次引入一个坐标系

,如果我们知道 A 和 B 的坐标,

我们可以很容易地通过平均计算 M 的坐标

你现在已经足够了解在皮克斯工作了。

我来给你展示。

所以,我要做一些有点可怕的事情,

然后在这里进行现场演示。

所以,我这里有一个四点多边形

,我的工作

就是用这个东西画一条平滑的曲线。

我将使用中点的想法来做这件事。

所以,我要做的第一件事

是一个我称之为 split 的操作,

它将中点添加到所有这些边缘。

所以,我从 4 分提高到 8 分,

但并不顺利。

我将

通过将所有这些点从它们现在所在的位置移动

到顺时针邻居的中点来使它更平滑一点。

所以,让我为你制作动画。

我将把它称为平均步骤。

所以,现在我得到了 8 个点,

它们稍微平滑了一点,

我的工作是做出平滑的曲线

,那我该怎么办?

再来一遍。 拆分和平均。

所以,现在我得了十六分。

我将把这两个步骤,

拆分和平均,放在一起,

我称之为细分,

这意味着拆分然后平均。

所以,现在我得到了 32 分。

如果这还不够流畅,我会做更多。

我会得到64分。

您是否看到从这些原始点出现的平滑曲线

这就是我们创建

角色形状的方式。

但请记住,我刚才

说过,仅仅知道静态形状

、固定形状是不够的。

我们需要对其进行动画处理。

并为这些曲线设置动画

,细分很酷。

你在玩具总动员中看到外星人了吗?

你知道他们发出

“哦”的声音吗? 准备好?

因此,我们对这些曲线

进行动画处理的方式就是对原始的四个点进行动画处理。

“哦。”

好吧,我认为这很酷

,如果你不这样做,门就在那里

,没有比这更好的了,所以。

这种分裂和平均的想法

也适用于曲面。

所以,我会分裂,我会平均。

我会分裂,我会平均。

将它们放在一起进行细分

,这就是我们如何

在三个维度中实际创建所有表面字符的形状。

因此,这种细分的

想法首先在 1997 年的一部

名为 Geri’s Game 的短片中使用。

Geri 实际上

在《玩具总动员 2》中客串了玩具清洁工。

他的每一只手

都是我们第一次使用细分。

所以,每只手都是一个细分面,

他的脸是一个细分面

,他的外套也是。

这是 Geri 在细分之前的手

,这是 Geri 在细分之后的手,

所以细分只是进入并平滑

所有这些方面,

并创建

您在屏幕和影院中看到的美丽表面。

从那时起,我们就以这种方式构建了所有角色。

所以,这是勇敢的主角梅里达。

她的衣服是一个细分曲面,

她的手,她的脸。

所有族人的脸和手

都是细分面。

今天,我们看到了加法、乘法、

三角函数和几何在我们的电影中如何发挥作用。

再花一点时间,

我可以向你展示线性代数、

微积分、积分

也如何发挥作用。

今天我想让你离开的主要事情

是记住你在高中学习的所有数学

,实际上直到大学二

年级,我们每天都在皮克斯使用。 谢谢。