Mark Hamill’s cameo as Luke Skywalker in the season two finale of “The Mandalorian” came as a surprise to fans and now, the series’ visual effects supervisor is explaining how they were able to de-age the actor.

“We knew we had to be faithful to the look of [Luke Skywalker] around the time of ‘Return of the Jedi,’ which was the last movie we saw him at that age. And that was the look we had to reproduce,” Industrial Light & Magic VFX supervisor, Richard Bluff tells Indiewire. The process is the focus of this week’s episode of “Disney Gallery: Star Wars: The Mandalorian” on Disney+. Hamill, now 69, was 32 at the time of “Return Of The Jedi”‘s release.

RELATED: Mark Hamill Reveals He’s Secretly Had Cameos In Every ‘Star Wars’ Movie Since ‘The Force Awakens’

“[I]t was important to [showrunner] Jon Favreau and [executive producer] Dave Filoni that we bring Mark Hamill in to perform there on set, dressed in costume, and using him in every way possible — not only to help advise on the performance but also to use his physicality and his actual face whenever possible,” he explains.

While Hamill was physically present on set, the production team also replied on body-double Max Lloyd-Jones because “we needed a body double in his thirties rather than Mark’s senior age now.” Bluff says Favreau was aware that a body in its 60s doesn’t move the way it does in its 30s so he “crafted the scene where there are only wide shots when Mark is walking through and then he comes to a stop, and he’s standing. So that’s why we felt we could leverage a lot of Mark’s skill into a wonderful performance.”

Favreau also went through a number of de-aging techniques at ILM, finally settling on Lola Visual Effect’s 2.5D process which was previously used to de-age Michael Douglas in “Ant-Man”.

“They effectively reproduced a de-aged version of Mark for the shots by combining the texture from his face and also Max’s younger face,” Bluff says. “The biggest challenge for this sequence was that we weren’t de-aging Mark in every single shot, and we had a variety of performances that Lola had to work on, too.”

RELATED: Mark Hamill Talks His Top-Secret Luke Skywalker Cameo In ‘The Mandalorian’

Lola works by applying a “Photoshop-like technique involving skin smoothing and shape warping through 2D compositing” including the “rapidly emerging deepfake tech, in which computer learning software combined photographs and footage of the young Hamill to create a CG composite of his face,” according to Indiewire. However, the deepfake technology was used merely as a guide.

The soft texture of Luke’s skin was also intentional, Bluff says. “People’s memory of Luke Skywalker isn’t in 4K sharp resolution. That was a choice to match some of the imagery that we’ve seen in the past,” he adds.

“Disney Gallery: Star Wars: The Mandalorian” is currently streaming on Disney+.