Quark VR is Now Live! Integrate It Into Your Unity Project [Tutorial]

Today we are happy to announce the integration of Quark VR with Unity. Everyone developing VR apps with Unity can now use Quark VR to stream full size desktop apps to mobile headsets like the Gear VR. In this tutorial we’ll see how to use Quark VR in your Unity project to stream desktop VR to the Gear VR. Look at the end of the post for a link to the final Unity build.

In this example, we’ll show you how to run Quark VR with the Unity VR samples. You can get them from the Unity Asset store. You will also need to download our Unity package. The zip contains 2 things – The Quark VR Runtime and our Unity Plugin (see image below). The Quark VR Runtime is the software which renders to the headset and reads the position data from it. Run the .msi file and follow the installation wizard.

Unity package

Now you need to import the Quark VR unity package into your Unity project. In the Unity Editor open the Assets menu and import a custom package (see image below).

Unity, Import custom package

The zip file you downloaded from our website contains the quarkvr.unitypackage. When you import it, it adds the following items to your Unity project:

quark vr unity package

Let’s quickly go through the list. The QuarkVRCameraRig.prefab is a game object which uses the QuarkVRCamera script. This script maintains the left and right eye cameras and their position.

public Camera leftEyeCamera { get; private set; }
public Camera rightEyeCamera { get; private set; }
public Transform lefteEyeAnchor { get; private set; }
public Transform rightEyeAnchor { get; private set; }

The two cameras render to a couple of textures which are passed to the native QuarkVrUnityPlugin.dll. This native plugin uses the Quark VR Runtime to do distortion and color correction, as well as to encode and stream each frame to our Gear VR app.

The unity package also includes the Moving Camera Rig. It is pretty similar to regular camera rig, but uses head orientation data to move the camera. You can use this prefab in the VR Flyer demo, for example.

Adding the scripts to your Unity project is pretty simple. You just drag a Camera rig to you project, making it a child of the Main camera:

Drag Quark VR camera rig

The last step is to install the Quark VR Gear VR app. Since this is our first release of the Quark VR SDK, we haven’t yet submitted the Gear VR app to the Oculus store. Instead, you can get Quark VR on Sideload VR.

Get their Android app from Google Play and follow the Setup process. After that you’ll be able to find Quark VR in the list of apps:

Sideload VR Setup

Quark VR on Sideload VR

In order for the streaming to work, you need to get your PC and phone on the same WiFi network. If you have the Quark VR running (as well as your Unity app), you should be able to see your desktop in the list of servers our Gear VR app can connect to. When you insert your phone in your Gear VR, you should see the following:

DesktopFound

Use the trackpad on the side of your Gear VR to tap and connect to your PC. Now you should be able to see the stream.

QuarkVrStream

That’s it, you’re all set! Give Quark VR a try and tell us what you think. You can also find the final Unity build here. Any feedback is welcome at office@quarkvr.io.

Leave a Reply

Your email address will not be published. Required fields are marked *