When a young version of Johnny Depp’s zany Jack Sparrow appears in a flashback in Disney’s Pirates of the Caribbean: Dead Men Tell No Tales — which topped the North American box office this weekend with an estimated $77 million debut — it became the latest example of the use of digital effects to “de-age” an actor for the purpose of having him or her appear in a flashback.

Moviegoers saw another example just a few weeks ago, when Guardians of the Galaxy Vol. 2 introduced a young Kurt Russell as his character, Ego. Disney/Marvel is clearly comfortable with taking this route, as it’s also brought audiences a young version of Michael Douglas in Ant-Man and Robert Downey Jr. in Captain America: Civil War.

“It definitely seems to be a trend,” says Industrial Light & Magic animation supervisor Hal Hickel, who won an Oscar for Pirates of the Caribbean: Dead Man’s Chest and recently completed Rogue One: A Star Wars Story. “It may be because it’s been done successfully and filmmakers realize it’s an option in telling a story, or maybe it has opened up an option that they need.”

For Ed Ulbrich, president of VFX and VR at Deluxe (the parent of VFX houses Method an Iloura), the use of this sort of work can be attributed to this “age of franchises, and the franchises are prequels and sequels and spinoffs. These stories go omnidirectional in time. Some of the characters become iconic. But we all get older."

“It’s very unforgiving; you either get it right or it’s glaringly obvious,” says Weta VFX supervisor and two-time Oscar nominee Guy Williams (Guardians 2) of these techniques.

So how exactly does it work?

Methods vary, but Christopher Townsend, VFX supervisor of Guardians of the Galaxy Vol. 2, explains the creation of the digital Kurt Russell, created by one of the film's VFX houses, Lola, which has earned a reputation for specializing in this sort of work. It started with collecting and examining '80s photos of Russell as well as his films from that period, such as Big Trouble in Little China, to come up with the desired look.

Next, director James Gunn and Lola “cast” actor Aaron Schwartz; in making the decision, Lola identified several actors with similar facial structure and Gunn brought them in for screen tests.

For filming, both Russell and Schwartz were identically dressed and makeup was applied to Russell to give him a younger appearance; both wore tracking markers on their faces for reference. First Russell performed the scene, and then Schwartz would step in and perform the same scene, mimicking what Russell did. Through  VFX, these takes were combined with some additional CG to create the final look and performance, frame by frame. “We cut and pasted pieces of Aaron’s geometry,” Townsend explains. “The geometry of the face changed, for instance his neck became fuller. We reshaped the jaw, chin, neck, lips — very specific details. It involved understanding the physiology of the human face.

“The technology is getting better, but it’s really the artists, that’s the key,” he emphasized. “It was a huge amount of work—months and months of artists working at computers.”

The digital Robert Downey Jr. from Captain America: Civil War and digital Michael Douglas in Ant-Man were both used for flashbacks and achieved in much the same way, says Townsend.