Buzz Aldrin on the moon, photographed by Neil ArmstrongNASA

Friday’s release of First Man, in which Ryan Gosling reenacts the true story of Neil Armstrong and the Apollo 11 mission, is in some ways a classic example of art imitating life. But many viewers may not realize that Armstrong’s real-life journey to the moon also imitated art.

The figure-eight trajectory flown by the Apollo moon missions was the very same path followed by fictional astronauts in a classic silent film from 1929, Woman in the Moon. It was plotted by Hermann Oberth, the German father of rocketry and the first in a long line of science consultants for cinema. These scientists have not only made the science in movies more realistic, but have also advanced the state of real science in the process.

Besides calculating a flight path so accurately that NASA would use the same trajectory 40 years later, Oberth designed the Woman in the Moon’s fake rocket so realistically that Hitler’s Gestapo confiscated the blueprints. The movie’s production team also paid Oberth to build and launch a real rocket for the premiere. Oberth failed to complete that ambitious assignment—an embarrassment that led him to leave town before the big day—but he did test-fire his first liquid-fueled rocket later that year.

Oberth was assisted in that experiment by a young Wernher von Braun, the Nazi rocketeer who was recruited by the U.S. government after World War II along with more than a thousand other German scientists as part of Operation Paperclip. He would ultimately become the director of NASA’s Marshall Space Flight Center and the chief architect of the Saturn V rocket that finally did carry men to the moon. Both von Braun and Oberth were in turn deeply inspired by Jules Verne’s sci-fi classic From the Earth to the Moon, a crystal-clear example of the sci-fi feedback loop, where sci-fi influences science, which influences sci-fi, which influences science.

One key aspect of this feedback loop is what the scientist turned communications-studies professor David Kirby calls “diegetic prototypes.” In his book Lab Coats in Hollywood: Science, Scientists, and Cinema, Kirby explains that fictional technologies can “foster public support for potential or emerging technologies.” For example, the space travel and AI technologies of 2001: A Space Odyssey and the driverless cars, targeted advertising, and gestural interfaces of Minority Report—which themselves were developed in close collaboration with real scientists and technologists—have helped define our shared visions of the future and drive innovation in the real world.

Beyond prototyping physical products, scientists have also used Hollywood consulting as an opportunity to test out new concepts and theories that could feed back into their real-world research. When the renowned physicist Kip Thorne served as a scientific advisor for Interstellar, he wrestled for months with the equations that would describe the behavior of black holes and wormholes for the film. Thorne was then able to leverage the movie’s massive CGI budget to visualize his theories, which led him to new insights and multiple scientific papers.

As the director Christopher Nolan said in a recent interview, speaking of Thorne and his team: “They’ve got all the equations. They’ve got all the mathematics. But they don’t have the indulgence that we have, of months and months of [digital-effects] render times.”

Mika McKinnon is another physicist who has consulted regularly for Hollywood. She got her start on the TV show Stargate: Atlantis, and in the process she “discovered” a stellar phenomenon before it was ever observed in reality. For one episode, the writers needed a destructive radioactive event that repeated every 45 minutes. They wanted to use a pulsar, a particular type of neutron star that sends out periodic waves of radiation. But a regular pulsar’s radioactive pulse wouldn’t be powerful enough. So McKinnon imagined a fictional binary pulsar system where a second star fed the energy of the first. As she told me later, “My pride and joy is that a couple of years ago, astronomers found a system like the one I described. I got to predict it in Stargate, and then they found it in real life.”

By creating an open intellectual space, science-fiction consulting can also prompt scientists to consider how they might address a challenge that hasn’t yet arisen in real life, like how to communicate with extraterrestrials. That was the task that the noted physicist and computer scientist Stephen Wolfram and his son, Christopher, were faced with when the producers of 2016’s first-contact story Arrival approached them for help. In response, the father-son team built software tools designed specifically to decode the alien glyphs used in the movie.

By making Hollywood’s narratives more credible, scientific consulting can often draw real-world attention to critical issues. Kirby’s book describes this phenomena as “the WarGames effect,” referring to how that 1983 movie’s depiction of hacking influenced real-world cybersecurity policy. Pandemic thrillers like Outbreak and Contagion prompted renewed attention and funding for that threat; Deep Impact and Armageddon’s depictions of planet-killing asteroids were a boon for NASA’s near-Earth-object tracking initiatives; and Contact was basically a big-screen funding pitch for the Search for Extraterrestrial Intelligence Institute.

Movies can also serve as advertisements for their science consultant’s theories on a particular scientific issue. This was the case for Jack Horner, the paleontologist who consulted on the original Jurassic Park movies. By leveraging Hollywood’s reach, Horner was able to introduce millions of people to his own theory, controversial when the movie first came out but now accepted as scientific consensus, that dinosaurs were not reptiles but the warm-blooded ancestors of today’s birds.

He was also able to advance his theories in other, more playful ways: Near the beginning of The Lost World: Jurassic Park, an onscreen paleontologist clearly modeled after a real-life paleontologist with whom Horner often disagreed is eaten by a Tyrannosaurus rex. So, in addition to the myriad other science-advancing benefits, serving as a consultant to Hollywood is also a delicious opportunity to tweak intellectual adversaries. As Horner dryly suggests in Kirby’s Lab Coats in Hollywood: “If you are ever arguing with someone, don’t let them be the advisor on a movie.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.