The first time an astronaut takes a spacewalk, in a way, it’s not his or her first time.

Thanks to virtual reality, NASA can make sure the people they put into space have some amount of experience under their belts before they have to perform complicated tasks in zero gravity.

Evelyn Miralles, principal engineer and lead VR innovator for the virtual reality laboratory at NASA’s Johnson Space Center, spoke at the Silicon Valley Virtual Reality Expo in San Jose, California on Monday about the longstanding role VR has played in training astronauts.

It started out at as an experimental pursuit in the 1990s. When the Hubble Telescope launched in 1993 and needed to be repaired, it demanded complex preparations.

“That was the beginning of virtual reality at NASA Johnson Space Center, and we’ve used VR since then,” Miralles said.

It wasn’t going to be a simple fix — they’d need to capture the telescope, bring it down to the bay of the shuttle, and then repair it.

See: VR industry leaders speak out on consumer adoption, diversity, and adult entertainment

“You can imagine how complicated it would be to train for this,” she said. The astronauts had to train separately to handle the shuttle arm and make the repairs, and also to do those tasks while weightless, by training in the pool. The two were too difficult to integrate.

That’s when NASA started thinking about how they could create a better training experience, something that was comprehensive and combined the experiences of hardware and environment.

These days, NASA has a virtual reality lab staffed with 4-6 engineers of various backgrounds, and built to accommodate training for crew members. She said that virtual reality training has also made it easier for the team to work together and communicate on one training experience.

There are four main areas where NASA uses virtual reality. The Extra-Vehicular Activities training prepares astronauts for space walks. Simplified Aid for EVA Rescue, or SAFER, simulates a situation where astronauts become detached from the shuttle, and have to use a backpack to navigate their way back. She said it’s a little more complicated than the Hollywood version in the recent movie Gravity. NASA also uses VR for robotics operations, relating to the shuttle and space station arm. Finally, zero-g mass handling training helps astronauts get a feel for doing things like manipulating payloads in zero gravity.

Everything from the many iterations of headsets to NASA’s own graphics engine (dynamic onboard ubiquitous graphics, or DOUG) is produced in-house. Miralles said the current HMDs they use have 1200×800 resolution, a 120 degree field of view, and no lag.

VR’s ended up becoming an important part of how NASA not only trains astronauts before they go into space, but, increasingly, while they’re there.

When discussion came up of astronauts like Scott Kelly spending extended periods of time in space — in his case, a year — NASA had to figure out a way to keep skills sharp, which eventually led to figuring out how to do VR training in space.

They couldn’t send up a bunch of electronics, so they essentially turned a laptop, webcam, and hook into a makeshift HMD. Imagine your laptop screen hang upside down over your face.

The rig has been successful, though Miralles said they are looking to using a consumer HMD in the future.

The NASA VR team also maintains a highly-detailed virtual reality model of the space station.

Virtual reality might even play a role further down the line, for example, to entertain astronauts on Mars, Miralles said.