Rogue One used CGI to bring back Grand Moff Tarkin, but how did they recreate the original trilogy villain? The Star Wars prequel surprised audiences by including Tarkin and a de-aged Princess Leia to fit into its place in the timeline directly before A New Hope. Although Tarkin has only four minutes of screen time, bringing him to life required a complex multi-step process.

Grand Moff Tarkin commanded the Death Star in A New Hope, looming in the shadows as a villain to rival even Darth Vader. Tarkin ordered the destruction of Alderaan, but he never escaped the Death Star after that, dying in the blast that destroyed the battle station. Peter Cushing, the iconic actor who portrayed Tarkin, died in 1994. Tarkin later appeared in animation and prequels with different actors, but Rogue One required Tarkin to transition directly into the events that happened next in Episode IV. Since a simple recasting would not live up to Peter Cushing’s Star Wars performance, the production crew worked their magic to bring Cushing back on screen.

Related: The Bad Batch Shows Why Rogue One & Mandalorian Are Disney's Biggest Successes

The first step in Tarkin’s Rogue One role required the performance of a real actor. British actor Guy Henry was cast to film Tarkin’s scenes, performing his best impression of Peter Cushing in full costume. Industrial Light & Magic would apply motion capture dots over his face, and the crew set up a head-mounted camera to capture all of Henry’s facial movements. Henry was called back to reshoot his performance several times as rewrites continued to change the movie during production. After Henry’s work was done, the animation and visual effects team used Henry’s performance to resurrect the image of the deceased actor.

Mandalorian’s Giancarlo Esposito Partly Based Moff Gideon on Tarkin

Henry’s movements were then transferred onto a digital model of Peter Cushing’s Tarkin. In order to get his look exactly right, the special effects team closely watched Tarkin’s original scenes and used a life-cast of Cushing’s face made for his appearance in the movie Top Secret! in the 1980s. After the actor’s movements animated Tarkin’s face, the visual effects team had to make changes to small facial movements. Even with Guy Henry’s best impression, he could not always move his lips or skin the way Peter Cushing would have, so those details were edited on the digital model. The lighting was also changed to match A New Hope to create the same effect on Cushing’s face. This model was superimposed over Guy Henry’s face to create the incredible facsimile of Tarkin.

Tarkin’s resurrection is a testament to the amazing visual effects achieved with modern technology. This process was used again in The Mandalorian to create the de-aged Luke Skywalker, though with more budget constraints limiting the accuracy of the model. While there are some ethical debates over whether it was right to resurrect Peter Cushing’s likeness, the production crew had the blessing of Cushing’s estate for the recreation and worked with great care to get the performance right. As this technology improves, Rogue One’s scenes with Grand Moff Tarkin may only be the beginning of the spectacular visual effects Star Wars brings to the screen.

Next: Star Wars: How Old Rogue One's Characters Are When They're Killed