Saturday, November 15, 2014

 

THE MATHEMATICS OF "FROZEN"

(Wait, there's math in Frozen?)

 
There are probably a great many children today whose first hearing of the word "fractal" was in the song "Let It Go" from the Disney film Frozen.  Come on, you know the song... sing with me:
          "My power flurries through the air into the ground.
          "My soul is spiraling in frozen fractals all around."
But just in case you forgot which part of the song this is, here is something to help you remember...
Ahhhh, those frozen fractals!
 
 Virtually everything you see in this shot is created using fractal geometry!
 

Okay, so exactly what is fractal geometry anyway?!?

I'm so glad you asked.  To some extent, a fractal is a repeating geometric pattern that is similar to itself at every scale, meaning, it looks the same as you zoom in and zoom out.  The word was first coined by Benoit Mandelbrot in the 1970's (which makes Elsa's use of the term pretty anachronistic, ja?), and he borrowed from the Latin word "fractus", which means "broken" or "fractured".  Beyond this, there is a lot of disagreement on how exactly to define a fractal.  Right now, it seems that a fractal simply must pass the eye test: "I don't know how to define it, but I know it when I see it."  To generate a fractal, one simply needs to take a basic geometric shape or pattern or rule or even a function, then repeat it over and over in an orderly fashion at increasingly micro and macro levels.  Still confused?  Here is a basic example to help explain....
 

The Koch Curve

Here is a simple fractal known as the Koch Curve:
Does this remind you of something?
This is what is known as a fourth power fractal.  What does that mean?  It means that a simple geometric shape is generated (first power) and then repeated three more times (fourth power), creating a geometric pattern of ever increasing complexity.  Still confused?  Let's look at the first power fractal of the curve:
 
The green line in this picture represents the basic shape used to generate the Koch curve, and since this is the first use of the shape, this is a first power fractal.  To generate the second power curve, simply repeat the pattern on each of the four green line segments, like this:
 

The lavender line is the second power fractal.  The picture above shows the second power fractal overlain on the first power one so you can see how the fractal scales down as it becomes more complicated.  We have gone from one large peak to four smaller ones.  The picture below shows the second power fractal by itself so we can see how with each repetition we are approaching the final shape created by the fourth power fractal:
Repeat this process again to get the third power fractal, like this:
Again, the third power fractal, shown by the purple line, overlays the second power fractal, and we have 16 even smaller peaks now.  Here is the third power fractal by itself:
 
One more repetition of the pattern gives us our final, fourth power fractal!  Put six of these fourth power fractals together, and you get something like this:
Eureka!  We have our snowflake!!
Looking at how much this very simple artificial snowflake begins to resemble the real thing, the utility of fractal geometry in a movie like Frozen becomes clear.  It is, in fact, no accident that this fractal resembles something from nature, for indeed fractals were first created to try and explain and explore the complicated designs of the natural world.  The fledgling computer animation industry of the late 1970's and early 1980's saw the usefulness of this type of geometry immediately.
 

Math versus Nature

The problem facing the first computer animators was finding a shortcut to create a simple digital landscape that emulates all the nooks and crannies and seeming randomness and complexity of a real landscape.  So, they turned to fractals.  Take a look at the following picture:
 
This is a fractal rendering to model the surface of a mountain, and one can easily see that as the power of the fractal increases, its approximation of a real mountain gets better and better.  The problem for early computer animators was that as the power of their fractals increased, it took longer for the computers to complete the calculations, known as renderings. In fact, rendering times increased exponentially as the powers of the fractals increased.  This was a severely limiting factor for the animators.  Some of the early results, while quite arresting at the time, seem positively quaint by today's supercomputer standards (as a side note, when Pixar was created in 1986, its primary purpose was to create animations to show off the computing power of Apple computers!).  Here is an early example from the 1985 film Young Sherlock Holmes:
This was the first example of a computer generated character in film.  The stained glass figure of a knight is able to come down from his window and walk around.  Because the character was made up of large, simple geometric shapes, the computers of the day were able to render the character in a reasonable amount of time.  In hindsight, he looks pretty dorky, but it was a start.  For another, perhaps better example, we turn to the 1982 film Star Trek 2: The Wrath of Khan.  Take a look at the following video:
Also Spock Zerathustra!  The spreading fire and the resulting mountain landscape were all rendered using fractals.  The geometry of the mountain ranges, while being a reasonable approximation for the real thing, is still pretty obvious.  However, as computing power has increased, so has the delicate complexity of CGI rendering, making it harder to tell truth from fiction.  Let's take a look at a few more examples:
 One of these ferns is the real thing, the other is a fractal.  Okay, so it isn't too difficult to tell which is which, but the fractal fern is a 20th power fractal and is more complex than anything in the Star Trek video.  Now we begin to see how more powerful computers allows for better approximations of nature's complexity. 
 

 Final thoughts

So, the next time you watch Frozen, keep a watchful eye for the fractals at play in creating the vaguely Norwegian world.  Chances are you won't notice most of them.  Some examples are easy to spot, like this:
The frost and the snowflake are created using fractal geometry.  How about this:
Elsa's ice palace is pretty obviously fractally generated.   And another:
Perhaps this one is not immediately obvious.  Fractals are also used to help simulate complex patterns of movement of large numbers of individual objects, like the snow particles in the picture above.  Fractals, fractals everywhere!!!
 
I will bet that from now on you will take more notice of the tremendous amounts of math that go into creating animated movies, but chances are most kids will not, and, at least until the movie is over, you might want to consider keeping it that way!!!  Cheers.
 
 
 
 
 


1 comment:

  1. Good pop mathematics coverage, well written. 5Cs: +
    Could make an exponential connection for added content... especially with the Koch snowflake.

    ReplyDelete