One of the most controversial elements of Rogue One: A Star Wars Story is its use of computer-generated imagery to bring back characters who appeared in a 39-year-old movie — as they appeared in that movie. The process of developing these digital recreations was difficult enough, but the ethical, legal and artistic questions surrounding it were even more thorny.

[Warning: The following contains spoilers about character appearances in Rogue One.]

Rogue One is a spinoff film, but it’s a direct prequel to the very first Star Wars movie, 1977’s Episode IV: A New Hope. The filmmakers behind Rogue One decided to use digital effects for two characters from A New Hope: Grand Moff Tarkin and Princess Leia Organa. Tarkin, the commander of the Death Star, was played in that film by Peter Cushing, who died in 1994. Carrie Fisher, who died today at the age of 60, was 19 when she donned Princess Leia’s white gown in A New Hope.

Fisher’s younger self only makes a cameo in Rogue One, appearing in the film’s final shot. However, Tarkin — referred to as Governor Tarkin in the movie — gets a lot more screen time, actually carrying on conversations with Imperial comrades such as Ben Mendelsohn’s Director Orson Krennic. As such, his CG self must bear a much greater load.

The effects specialists at Lucasfilm and Industrial Light & Magic combined live action with digital wizardry for both Tarkin and Leia. ILM chief creative officer John Knoll, who is credited alongside Gary Whitta for Rogue One’s story, described the process to the New York Times as “a super high-tech and labor-intensive version of doing makeup.”

Here’s how it worked. During the filming of Tarkin’s scenes, he was played by the British actor Guy Henry, who resembles Cushing in size and could speak reasonably similarly. Henry wore performance-capture equipment on his head, as you can see below, so his face could be replaced with the digital recreation of Tarkin’s.

Rogue One filming - Guy Henry wearing performance capture equipment
Guy Henry wearing performance-capture equipment during the filming of Rogue One.
Industrial Light & Magic/Lucasfilm via New York Times

The process was slightly different for Princess Leia. Initially, the camera is behind her; in that shot, she is played by the Norwegian actress Ingvild Deila. When Leia is shown from the front, it’s Deila’s hand that we see. But the character’s face, hair and costume are digital recreations based on footage from A New Hope, reports the New York Times.

In replacing Henry’s face with Tarkin’s, the animators worked hard to approximate Cushing’s original delivery. The effects take into account subtleties like the way his lips moved when he spoke a particular word. At the same time, the filmmakers did not prioritize that element of the digital performance.

“Realism had to trump likeness,” Hal Hickel, animation supervisor at ILM, told the New York Times.

The filmmakers didn’t necessarily succeed in that respect — in our Rogue One review, we said the CG for Tarkin “never quite manages to escape the realm of cartoony.” But more contentious than whether the digitally recreated Tarkin rests in the uncanny valley is the issue of choosing to use CGI to resurrect a character played by a person who is no longer alive.

Hollywood has been doing this ever since the technology made it possible; think of Nancy Marchand as Livia Soprano in the third season of The Sopranos, which aired in 2001, or Oliver Reed as Proximo in 2000’s Gladiator. One of the more high-profile instances of this came in Furious 7, in which Paul Walker appeared after his untimely death.

Rogue One’s filmmakers defended their decision, noting that it was primarily motivated by the story. The concept of the movie is based around stealing the plans to the Death Star — which Tarkin commands — and the weapon fires upon multiple planets during the film.

“If he’s not in the movie, we’re going to have to explain why he’s not in the movie,” Kiri Hart, head of development for Lucasfilm’s story group and a co-producer on Rogue One, told the New York Times.

As is noted in the credits of Rogue One, Lucasfilm also obtained permission from Cushing’s estate to recreate Tarkin for the film. Both his estate and Carrie Fisher received special thanks in the credits. But the filmmakers did consider other options in case the effects didn’t work out, such as having Tarkin appear only in a hologram or giving his dialogue to other characters.

But it sounds like a digital recreation was always the plan for Leia — even if it seems like a simple shot of the character from behind, with Deila in the iconic costume and hair buns that Fisher wore in A New Hope, would have been enough.

“To deliver on that moment of hopefulness, that is really underscored by the fact that you do get to see her face,” Hart told the New York Times. “That’s the best possible use of effects, to enhance the meaning and the emotion of the experience for the viewer.”

Rogue One filmmakers explain how they digitally recreated two characters