OculusImplementation

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

This Page sums up the Efforts made / to make, to add Oculus Rift VR Helm Support to FlightGear documenting the whole effort and what you've got so far, which will also help others to get started with this much more easily [1]

The main Forum Thread is Oculus Rift Implementation This is a link to the FlightGear forum.

There are (at least) two approaches:

  • integrate the Oculus Rift SDK into the C++ Code (Advantages are: easy Setup (i.e. Direct to Rift Mode), Execution speed
  • deal separately with Headtracker and Display Integration (Advantages are: flexible setup i.e. headtracker on different Workstation, streaming to different Displays, Multiplatform Widows, Linux, evtl MAC)

direct c++ Integration has been started by Gouranga This is a link to the FlightGear forum. and Gijs This is a link to the FlightGear forum.

Separate Headtracker tests are succesfull using


Motivation

Getting the position and orientation data from the VR goggles to FlightGear and getting it to control the view through e.g. view.nas should be fully possible. In fact some related work has been done in the field of head tracking, in essence using some input from either hardware or software to control view movements. There is also functionality for stereoscopic viewing built in into FlightGear. (Click on the following links to search the forum for posts about head tracking This is a link to the FlightGear forum. and stereoscopic viewing This is a link to the FlightGear forum..)


What I really would like to see though is being able to use the Oculus Rift. They are expensive, but not compared to many other VR goggles, and... they are in some ways more innovative than an order of magnitude more expensive VR goggles. [2]

Status

The latest news on this seem to be in these two topics. In essence not much seem to be happening at the moment.[3]



successfully support oculus but still not stable. http://imgur.com/mV6AoKg[4]


Cquote1.png summary of my advances: [1] This is a link to the FlightGear forum.

- There is no problem with the headtracking. There are several ways to connect the headtrack to FlightGear, and any of them should work. My way was using an intermediate program to read the position from the oculus and send it to FlightGear using the telnet server. It worked awesomely.

- The 3D effect is another thing. In my opinion, it should be an effect provided by OpenSceneGraph and not FlightGear, as the other stereoscopic effects are. The integration must be done outside the FlightGear community. There are several efforts to integrate OpenSceneGraph and the Oculus. If one of them is successful (I have not checked lately), FlightGear must just switch it on and use it. Currently, you can use the Oculus with the split-screen option (in View->Stereoscopic) and configure 0 as eye separation. You won't perceive any depth, but the aircraft and scenery will be shown perfectly. Well, not perfectly, it will be deformed at the borders.
— ludomotico (May 6th, 2015). Re: Virtual goggles.
(powered by Instant-Cquotes)
Cquote2.png


  • Using Oculus Rift DK2 and Oculus SDK 0.3 on Linux. FlightGear fully updated to current GIT. OpenSceneGraph 3.2.0
  • Image: using stereoscopic mode, fullscreen, eyes distance=0. Obviously, the 3D effect is lost but the immersion is not. I'm still researching how applying the barrel distortion the Oculus needs to create the 3D effect, but my bet is still on an OpenSceneGraph plugin without any modification in FlightGear or SimGear (apart from the switch in the stereoscopic menu to activate this mode) I'll wait for the 0.4 version of the Oculus SDK for Linux.
  • tracking position: you'll find below a standalone program that tracks the position of the headset and moves the view accordingly. This assumes FligthGear is running with a telnet server in port 9000. It seems the heading needs some reset if you put the headset on the table, so do not put the headset on the table while running the tracker :D I'm guessing and not really sure, but I think v0.3 of the SDK uses internal accelerometers to track the position and does not use the external camera for synchroniation. I think the external camera is only supported from v0.4 of the SDK. I have only tested this program in Linux.

To build the position tracker, you have to download and build the Oculus SDK (v0.3 at the time of writing this, 0.4 version is not yet available for Linux) and change the paths of the Oculus SDK in the Makefile. Then, "make demo1" and run "demo1" with the Oculus and FligthGear activated. https://dl.dropboxusercontent.com/u/13130748/oculus.zip This is only a test, it is not optimized and full of debug messages and it uses some classes for Sockets with no clear license. Do not assume it is GPL because it is not! Apart from the lacking of the 3D effect, flying with this needs some minutes to get used to. Once you get the idea, the feeling of complete immersion and being able to move your head to see the environment is awesome! The resolution is not the best and the pixels are very evident, but I'm still not sure if I'm using the max resolution the Oculus supports [5]

USB/HID Support

For a summary, refer to: USB HID Support Here's a list of postings/threads covering the status of Saitek USB/HID device support in FG:


Note that there's also a dedicated ticket/feature request (see the tracker at: #619 HID abstraction layer for Nasal ) [6]

Alternatives

There is an alternative to Oculus Rift that have some interesting aspects in regard to flight simulators: CastAR It is a very different setup from what most of you have seen before. For starters it is based on using retroreflective materials ("reflex sheets") and a projector built into the glasses. For head tracking the glasses also have a camera that tracks IR diodes.[7]

Opentrack

where to get opentrack...use this link... https://github.com/opentrack/opentrack on the page that it opens you'll have to scroll down to the readme section and select the binary releases link to download the program.

You can create different profile within opentrack...they're self explanitory. FlightGear has to also be set in stereoscopic side by side mode....this is kinda hard to do...so I set up a shortcut key in my video driver to swap screens...that way I can switch screens back and forth while FlightGear is running. The file menus at the top are not visible inside the oculus, s this saves huge headaches. Keep the tread alive! There will be more people interested in the subject as it becomes more prevalent...Maybe somebody who knows how to program the barrel shader into OSG so the view doesn't skew when you rotate your head side to side...(this will make you very queey)[8]


  • is multi platform (windows, linux),
  • can read the Oculus Rift Tracker as Input (in different sdk versions)
  • and comes with a headtracker.xml Protocol for generic input in FlightGear.


Display Integration could be done by the FlightGear/OSG Stereosopic side by side Support, but lacks the special 'Barrel distortion' transformation needed for each eye.
Successful tests here use the Stereoscopic side by side Mode, with eye distance=0, but still barrel distortion.
this could of be either

  • coded in C++ into the render pipline without SDK need as a shader

or

  • done as a shader in the FG shader system without C++ code?


Gijs has begun work on the Lens distortion shader

Open Questions

  • is it possible (or feasable) to integrate a shader into the action system, i.e. Action Display with Rembrand active
Answer is YES, with rembrand active, there is already a distortion shader in place, which could be used or adapted (without code changes)
  • would that be before the Side by Side step in the rendering pipeline as a single eye distortion, or afterwards as a side by side distortion shader
Answer is, that the stereoscopic OSG Side by Side option is NOT available with rembrand
  • so is it possible to have side by side views done with rembrand AND have the barrel distortion shader in place for each eye view
(mmartin)should be, will investigate

Related

  1. Hooray (Mar 6th, 2015). Re: .
  2. Johan G (Apr 14th, 2013). Re: Virtual goggles.
  3. Johan G (May 6th, 2015). Re: Virtual goggles.
  4. nicole_yaoyao (Nov 24th, 2015). Re: .
  5. ludomotico (Aug 4th, 2014). Re: .
  6. Hooray (May 8th, 2015). Re: Support for Saitek Hardware .
  7. Johan G (Jul 7th, 2015). Re: Virtual goggles.
  8. water_raptor (Mar 5th, 2015). Re: .