Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

Oculus Rift Output with AppOculus Plugin

An AppOculus plugin is used to support the Oculus Rift head-mounted display. The plugin supports all HMD types supported by Oculus Rift SDK.

Notice
Since Oculus VR has stopped supporting Linux and Mac, the plugin is available only for Windows.

The AppOculus plugin provides the VR mode that allows for rendering to both the Oculus Rift head-mounted display and the PC display. When the VR mode is disabled, the image is rendered only to the PC display. The mode can be toggled by using the engine.oculus.setEnabled() function.

Both the windowed and the full screen modes are supported. On the PC display the image is rendered as follows:

Valley benchmark rendered on PC display with AppOculus

Notice
The HD mode is also supported.

To use the Oculus Rift virtual display with Unigine, perform the following:

  1. Plug in the Oculus Rift.
  2. Get and configure the Oculus Rift SDK or Oculus Runtime.
  3. Implement the application logic and launch the AppOculus plugin on the application start-up.

See Also

To run the plugin sample from the Unigine SDK Browser, go to the Samples tab, choose UnigineScript -> App and run the app_oculus_00 sample.

Launching AppOculus

To launch the plugin, specify the extern_plugin command line option on the start-up:

Shell commands
main_x86d -extern_plugin "AppOculus"

Also you can create a new project with Oculus support by checking the Oculus support option on new project creation via Unigine SDK Browser.

Head-tracking support is available by default.

AppOculus Options

The following CLI options can be specified on the application start-up:

  • oculus_density - the render target pixel density. In other words, this is the ratio of the number of render target pixels to display pixels at the center of distortion. The default value is 1.0 (the render target pixel density matches the display surface at the point on the display).
  • oculus_scale - the world scale. The default value is 1.0.

Shell commands
main_x86d -extern_plugin "AppOculus" -oculus_device 0 -oculus_density 1.0 -oculus_scale 8.0

Plugin Compilation

Full Oculus SDK sources are required for the AppOculus plugin compilation:

  1. Get the Oculus Rift SDK
    Notice
    The 0.8 version is required.
  2. Set path to the <Oculus Rift SDK>/LibOVR folder in the OCULUSROOT environment variable:
    Shell commands
    OCULUSROOT=<Oculus Rift SDK>/LibOVR
  3. Compile the plugin with the build script:
    Shell commands
    C:\UnigineSDK\utils>build.py --plugin AppOculus
    You can also compile the plugin manually with Scons:
    • Go to the <UnigineSDK>\source\plugins\App\AppOculus via the command line
    • Type scons and press ENTER:
      Shell commands
      C:\UnigineSDK\source\plugins\App\AppOculus>scons
Last update: 2017-07-03