Skip to content

Instantly share code, notes, and snippets.

@zanppa
Last active June 26, 2020 20:46
Show Gist options
  • Select an option

  • Save zanppa/2d0f83217321c1c249723ac983429974 to your computer and use it in GitHub Desktop.

Select an option

Save zanppa/2d0f83217321c1c249723ac983429974 to your computer and use it in GitHub Desktop.
FlightGear headtrack + mirroring for cardboard virtual reality

This is a list of how I got FlightGear to (somehow) work on cardboard VR glasses.

Done on windows 10 and Android 9 phone.

It should work if PC and phone are on the same wifi, but update rate is most likely better with USB connection, USB network sharing on the phone, and phone (and PC) set to airplane mode...

Note that the software I used are ones I found to work, I have no other connection to them. Also, you do everything on your own risk!

Check the PC ip address with ipconfig.

Head tracking

  1. Install OpenTrack on the PC
  2. From OpenTrack's doc\contrib\FlightGear\Protocol directory copy the headtracker.xml' to FlightGear's data\Protocol` directory
  3. From OpenTrack's doc\contrib\freepie-udp copy the FreePIE_IMU_Android9.apk to the phone and install it
  4. Launch OpenTrack on the PC and set input to "FreePIE" (port 5555) and output to FlightGear (port 5542)
  5. Launch FreePIE on the phone, set the PC's IP address and port and start the output. Opentrack should show the rotating octopus if everything works.
  6. Launch FlightGear with fgfs.exe --generic=socket,in,25,localhost,5542,udp,headtracker (note the port 5542 and the name of the xml file)
  7. Rotate your phone and FlightGear's view should turn. If something is wrong, try to tune the axis in OpenTrack

Screen mirroring

  1. Install TightVNC server on the PC
  2. Launch the VNC server
  3. Configure VNC server (right click on the tray icon --> Configuration), at least set viewer password, maybe address restrictions
  4. Install RealVNC's VNC viewer on the phone
  5. Add the connection by giving it some name and PC's IP address. Try to connect and enter view password. Hopefully it works.
  6. Hide the menu bar (from the "pin" icon) and switch to landscape mode

Stereo view

  1. From FlightGear's View meny select Stereoscopic View Options and set the HORIZONTAL_SPLIT
  2. Adjust eye separation to match your viewer

With everything set up, launch everything and FlightGear and put the phone in the cardboard glasses and enjoy.

I got very bad framerate but it is most likely due to my slooooow laptop, maybe this would work better with a better PC...

The view location in fgfs is often wrong because OpenTrack overwrites the aircraft's view position offsets.

There is no distortion correction shader or anything, but it does not seem to matter too much.

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment