Getting Started with Varjo Plugin for Unity

Note: you are currently viewing documentation for a beta or an older version of Varjo

Due to the Bionic display, there are some differences between developing for the Varjo headset compared to other VR headsets. Varjo plugin for Unity provides the necessary Unity scripts and plugins in order to render content to the Bionic Displays. The Varjo plugin for Unity also provides scripts for input and controller tracking as for the moment you cannot use Unity’s internal VR functions to do so.

INSTALLATION

You can download the Unity plugin from the Downloads page.

  1. If this is your first installation of the Varjo plugin for Unity, simply unzip Varjo plugin for Unity zip to any folder of your choice and copy the Assets folder to your project. The Varjo plugin for Unity will constantly update, and it is recommended to use the latest version with the latest features.
    1. For updating instructions for the Varjo plugin for Unity, refer to the “Updating plugin” section.
  2. Varjo and VarjoSteamVR will be at the root of your assets folder by default. Feel free to move them to a different folder in your project if needed.

Note: All of the screenshots in the Unity section of Varjo’s documentation are taken from Unity software version 2018.3.2f1. The user interface of the Unity software might change in future versions.

Note: Only 64-bit builds are supported by Varjo headsets.

UPDATING YOUR EXISTING UNITY PROJECT

If you are migrating a previously developed project to work on the Varjo headset, follow the “Updating an existing Unity project” guide to make sure your project is compatible.

If you wish to keep your previous project settings, you can unzip only the Assets folder. However, make sure that the settings in the Required Unity Settings section are enabled, otherwise VarjoManager will display an error and won’t work correctly.

REQUIRED UNITY SETTINGS

Apply the following settings before proceeding with developing your project. You can access the Settings through Edit > Project Settings

  • Navigate to Edit > Project Settings > Player
  • Depending on the Unity software version you might have either an XR Settings or Other Settings section available
  • Make sure the Virtual Reality Supported checkbox is not selected.

The reason for this setting is that currently the plugin can only work with the Varjo headset and not any other VR headsets.

  • Navigate to Edit > Project Settings > Quality
  • Set V Sync Count to Don’t Sync

If you want to switch to development for a different VR device, undo the changes above.

We recommend applying the following settings for creating a better VR experience:

Color space

  • Navigate to Edit > Project Settings > Player
    • Under Other Settings **set **Color Space to Linear

You can read about the benefits of the Linear Color Space in Unity documentation. In short, it makes the colors appear better.

Anti-aliasing

  • Navigate to Edit > Project Settings > Quality *
  • Set Anti–Aliasing to 2x Multi Sampling
  • Normally in a VR project, you would set Anti-aliasing as high as possible. However, since the Varjo headset is using the human-eye resolution Bionic Display™, you can save resources otherwise spent on anti-aliasing while still getting a great image quality.

Rendering path

  • Anti–Aliasing requires Rendering path set to Forward

GET FAMILIAR WITH VARJO PLUGIN’S ASSETS

Here are the files you can expect to find in your project after successfully installing the Varjo plugin and creating/importing your project.

Plugins folder

Varjo and OpenVR dll files.

Prefabs folder

VarjoUser Prefab

VarjoUser: Assigns VarjoManager. VarjoUser and tracking to be bound to each other. It is used for teleportation in the VR environment while keeping real world bounds intact.

TrackedDevices: Manages SteamVR™ tracking. It works the same way as in the SteamVR™ Unity plugin. Left and right controllers can be used to get location, orientation, and input data. If more tracked devices are used, they are either assigned runtime or dragged to the TrackedDevices list.

VarjoCamera: Prototype for view cameras. All applicable settings and scripts are used from this to render for Varjo. If you want to expose view cameras for individual customization, you may do so from the VarjoManager inspector in VarjoUser.

Viewport cameras can be generated by selecting Generate viewport cameras. If you have the Copy Camera Components checkbox selected, the components of the VarjoCamera are copied to each of the individual view cameras.

Scripts folder

VarjoMainCamera: Renders VarjoViewCameras and passes the combined render target to the plugin.

VarjoManager: Initializes Varjo for the scene. Requires the Varjo headset or Compositor in windowed mode (refer to Developing without the Varjo headset to work in the scene. Shows Varjo specific settings. Assigns and generates view cameras. If the VarjoCamera inspector field is left empty, the camera with the MainCamera tag is used for rendering.

VarjoMatrixUtils: Utility functions for matrix operations.

Varjoplugin: DLL import.

VarjoViewCamera: Rendering for one viewport. The VarjoManager creates these; do not attempt to manually add them.

Editor/VarjoManagerEditor: Editor interface of VarjoManager

VarjoSteamVR folder

Passthrough of stripped down SteamVR™ plugin wrapped under the Varjo namespace. This allows you to use the SteamVR™ tracking and input functionality that works in the same way as the SteamVR™ Unity plugin.

Examples folder

The Varjo plugin for Unity is supplied together with the examples and you can see them in the Examples folder. These are covered on Unity Examples page.