SPOILER ALERT: This article contains key details about the plot and characters of “Avengers: Endgame.” Do not read if you haven’t watched the movie.

“I put the brains and the brawn together — and now look at me:” On of the biggest surprises of Marvel’s “Avengers: Endgame” is the reinvention of Hulk, who embraces his powerful side to become a smart and sensitive green guy. Marvel comic book fans already know this incarnation as Professor Hulk, and in “Endgame,” he is building impressive technology, keeping his temper, and even cracking some jokes. “I know! It’s crazy,” he can be heard saying in a pivotal scene that reintroduces the character. “I’m wearing shirts now!”

Hulk is once again played by Mark Ruffalo, as he has been since “The Avengers” in 2012, with the help of visual effects from Industrial Light & Magic (ILM). To turn Hulk into Smart Hulk, the team at ILM decided to inject a bit more of the actor’s human side into the character than in previous Marvel movies. “We wanted to get that proper balance between Ruffalo and Smart Hulk,” said ILM visual effects supervisor Russell Earl in a recent interview with Variety.

© MARVEL

Essential to making Smart Hulk more of a complex character was the use of cutting-edge performance capture technology dubbed Anyma. The Anyma system was originally developed at Disney Research, and productized in partnership with ILM. In fact, ILM had been testing Anyma since 2012, and the technology is being used for a few other movies that are currently in production as well. However, “Avengers: Endgame” is the first film to feature an Anyma-captured character to be released on the big screen.

The key difference between Anyma and previous performance-capture systems is that it is capable of capturing a lot more information. “It analyzes pixel-level detail,” explained Earl.

Existing performance capture systems largely rely on dots that are glued all over an actor’s face to capture basic facial expressions. Anyma on the other hand can capture pore-level information, which can then used by animators to control over 200 individual facial attributes — think subtle eye muscle movements, or different types of smiles. “It definitely created more of a cohesive face,” Earl said.

© MARVEL

© MARVEL

However, ILM didn’t replace its existing performance capture system outright. Ruffalo was still being filmed with dots glued to his face just to give the team some options for the processing of the captured data. ILM also still made use of Medusa, its existing performance capture system, to capture facial poses.

The combination of marker-based technology and Anyma was in part due to the timing of the production. “Avengers: Endgame” was shot right after “Avengers: Infinity War,” and things were already very much underway when ILM was ready to implement the new technology. “We were full, heavy into production,” said Earl.

Changing out a key piece of technology while the production of a movie is underway is a bit like swapping out a car’s engine halfway through a race. “We basically rebuilt the entire facial pipeline,” said Earl. Getting the new tech up and running came down to the wire. “It was nerve-racking,” he recalled. “It kept me up at night.”

In the end, the result was all worth it — especially since the work helped to deliver a major surprise for theater audiences. “Smart Hulk wasn’t shown to the public in trailers and marketing,” said ILM animation supervisor Kevin Martel. “It was kept under wraps until it came out.”

What’s more, “Endgame’s” use of time travel as a plot device made it possible for audiences to directly compare the newly-reinvented smart Hulk to the green giant they remembered from past Marvel movies. “Getting to see our 2 Hulks on screen was a lot of fun for us,” said Martel.

Speaking of time travel: ILM’s role in the production of “Avengers: Endgame” wasn’t just to create smart hulk. The visual effects powerhouse also had its hand in creating the end battle scene, and most of the other animated characters, including Iron Man, Iron Patriot, Ant Man and others.

© MARVEL

© MARVEL

ILM’s visual effects also were at the core of the time travel in “Avengers: Endgame,” which included a trip back to the world of the original 2012 “Avengers” movie. Reusing some of the original assets from that film was a challenge on its own, especially since production technologies have advanced so much. “Everything was still on floppy disks,” joked Earl, adding: “Nothing worked out of the box.”

The team did some enhancements to the original 2012 Hulk, including an upgraded muscle system. However, it only could take upgrades so far, as the results weren’t supposed to look out-of-place to fans of the franchise. “It almost feels like a deleted scene for the other film,” said Martel.

Revisiting the original “Avengers” also helped ILM’s team to appreciate the advancements in technology as well as artistry. “The tools have gotten better, and the artists have gotten better as well,” Earl said. No one could have better encapsulated that progress than the new smart Hulk character.

Said Earl: “Mixing the brains and the brawn is (akin to) mixing the tools and the art.”