UCLA mathematics professor Joseph Teran, a Walt Disney consultant on animated movies since 2007, is under no illusion that artists want lengthy mathematics lessons, but many of them realize that the success of animated movies often depends on advanced mathematics.
“In general, the animators and artists at the studios want as little to do with mathematics and physics as possible, but the demands for realism in animated movies are so high,” Teran said. “Things are going to look fake if you don’t at least start with the correct physics and mathematics for many materials, such as water and snow. If the physics and mathematics are not simulated accurately, it will be very glaring that something is wrong with the animation of the material.”
Teran and his research team have helped infuse realism into several Disney movies, including "Frozen," where they used science to animate snow scenes. Most recently, they applied their knowledge of math, physics and computer science to enliven the new 3-D computer-animated hit, “Moana,” a tale about an adventurous teenage girl who is drawn to the ocean and is inspired to leave the safety of her island on a daring journey to save her people.
Alexey Stomakhin, a former UCLA doctoral student of Teran’s and Andrea Bertozzi’s, played an important role in the making of "Moana." After earning his Ph.D. in applied mathematics in 2013, he became a senior software engineer at Walt Disney Animation Studios. Working with Disney’s effects artists, technical directors and software developers, Stomakhin led the development of the code that was used to simulate the movement of water in “Moana,” enabling it to play a role as one of the characters in the film.
“The increased demand for realism and complexity in animated movies makes it preferable to get assistance from computers; this means we have to simulate the movement of the ocean surface and how the water splashes, for example, to make it look believable,” Stomakhin explained. “There is a lot of mathematics, physics and computer science under the hood. That’s what we do.”
“Moana” has been praised for its stunning visual effects in words the mathematicians love hearing. “Everything in the movie looks almost real, so the movement of the water has to look real too, and it does,” Teran said. “'Moana' has the best water effects I’ve ever seen, by far.”
Stomakhin said his job is fun and “super-interesting, especially when we cheat physics and step beyond physics. It’s almost like building your own universe with your own laws of physics and trying to simulate that universe.
"Disney movies are about magic, so magical things happen which do not exist in the real world," said the software engineer. "It’s our job to add some extra forces and other tricks to help create those effects. If you have an understanding of how the real physical laws work, you can push parameters beyond physical limits and change equations slightly; we can predict the consequences of that.”
To make animated movies these days, movie studios need to solve, or nearly solve, partial differential equations. Stomakhin, Teran and their colleagues build the code that solves the partial differential equations. More accurately, they write algorithms that closely approximate the partial differential equations because they cannot be solved perfectly. “We try to come up with new algorithms that have the highest-quality metrics in all possible categories, including preserving angular momentum perfectly and preserving energy perfectly. Many algorithms don’t have these properties,” Teran said.
Stomakhin was also involved in creating the ocean’s crashing waves that have to break at a certain place and time. That task required him to get creative with physics and use other tricks. “You don’t allow physics to completely guide it,” he said. “You allow the wave to break only when it needs to break.”
Depicting boats on waves posed additional challenges for the scientists.
“It’s easy to simulate a boat traveling through a static lake, but a boat on waves is much more challenging to simulate,” Stomakhin said. “We simulated the fluid around the boat; the challenge was to blend that fluid with the rest of the ocean. It can’t look like the boat is splashing in a little swimming pool — the blend needs to be seamless.”
Stomakhin spent more than a year developing the code and understanding the physics that allowed him to achieve this effect.
“It’s nice to see the great visual effect, something you couldn’t have achieved if you hadn’t designed the algorithm to solve physics accurately,” said Teran, who has taught an undergraduate course on scientific computing for the visual-effects industry.
While Teran loves spectacular visual effects, he said the research has many other scientific applications as well. It could be used to simulate plasmas, simulate 3-D printing or for surgical simulation, for example. Teran is using a related algorithm to build virtual livers to substitute for the animal livers that surgeons train on. He is also using the algorithm to study traumatic leg injuries.
Teran describes the work with Disney as “bread-and-butter, high-performance computing for simulating materials, as mechanical engineers and physicists at national laboratories would. Simulating water for a movie is not so different, but there are, of course, small tweaks to make the water visually compelling. We don’t have a separate branch of research for computer graphics. We create new algorithms that work for simulating wide ranges of materials.”
Teran, Stomakhin and three other applied mathematicians — Chenfanfu Jiang, Craig Schroeder and Andrew Selle — also developed a state-of-the-art simulation method for fluids in graphics, called APIC, based on months of calculations. It allows for better realism and stunning visual results. Jiang is a UCLA postdoctoral scholar in Teran’s laboratory, who won a 2015 UCLA best dissertation prize. Schroeder is a former UCLA postdoctoral scholar who worked with Teran and is now at UC Riverside. Selle, who worked at Walt Disney Animation Studios, is now at Google.
Their newest version of APIC has been accepted for publication by the peer-reviewed Journal of Computational Physics.
“Alexey is using ideas from high-performance computing to make movies,” Teran said, “and we are contributing to the scientific community by improving the algorithm.”