Skip to main content
Inspiring
June 16, 2015

Unity 5.1 and the Oculus Integration (Official Info)

Howdy,

A lot of changes are occurring with Unity VR development quickly, so we wanted to be sure to give you a clear heads up about what is happening, when it will happen, and what it means for developers.

= Unity First-Party Support =

Unity 5.1 introduced first-party support for virtual reality, making it easy to substitute a stereoscopic VR camera for your main camera by selecting the "Virtual Reality Supported" check box in Player Settings. The initial release of v 5.1 provides support for the Oculus Rift only.

On June 12, Unity released version 5.1.0p1, adding Gear VR support. All developers wishing to update to Unity v 5.1 should select this release, which is available for download here:
http://unity3d.com/unity/qa/patch-releases

For details on implementing Unity's first-party VR support, see the Unity manual: http://docs.unity3d.com/Manual/VROverview.html.

= Unity 5.1 and the Oculus Integration =

Unity 5.1 first-party VR support is incompatible with legacy versions of the Oculus Unity Integration (versions 0.6.0 and earlier). Projects using legacy versions of the Integration will only work with Unity v 5.1 if the "Virtual Reality Supported" box in Player Settings is not selected. In that case, they should work normally.

Oculus will be shipping an update to our Unity Integration shortly. If you import the new Oculus Integration version into a legacy VR project, it will work normally with Unity 5.1.

Once you update to this version, our Integration will work for the Rift and Gear VR if "Virtual Reality Support" is enabled.

= Known Issues =

Moving to Unity 5.1 is a substantial upgrade for VR development, and we recommend carefully choosing your timeframe for making the update. There is always risk in moving early to a new major release that you may encounter problems related to VR performance or otherwise.

Please let us know about any issues you encounter in the Oculus Unity forums, and keep your eye out for updates.

We are currently aware of the following issues with 5.1:

• All moonlight scripts, including platform UI, CPU/GPU levels, and overlay, are currently incompatible with 5.1.0. Updated versions will come with 0.6.0.1. The following features will no longer work:
• MediaSurface
• TimeWarp sub-stepping (only supports 60, no longer 20 or 30)
• Linear lighting (sRGB) and eye texture MSAA currently don't work. This will be fixed in Unity 5.1.0p2.
• VR.VRSettings.renderScale has no effect on Android.
• There is currently no way to render separate content (stereo video) to each eye. This may come back in a future Unity version.

For release notes and known issues in Unity 5.1:
https://unity3d.com/unity/whats-new/unity-5.1
    This topic has been closed for replies.

    108 replies

    Inspiring
    October 3, 2015
    Sounds like we need to enable mipmap generation or HQ distortion for your use case (heavily oversampling the eye buffers). We'll take a look, but the soonest we could ship a fix is several weeks from now. Are you blocked on this?
    Participant
    October 5, 2015
    "vrdaveb" wrote:
    Sounds like we need to enable mipmap generation or HQ distortion for your use case (heavily oversampling the eye buffers). We'll take a look, but the soonest we could ship a fix is several weeks from now. Are you blocked on this?


    Thanks for your response! If we know there is a fix coming for this, we can go on using the new Integration (asap or a workaround for the meantime would be perfect, though)
    Some of our business clients are still using Laptops at the Moment, i guess there is no way we can get this update (or a workaround or something) in the Unity 5.1 integration that still uses the 0.6 SDK?

    Anyway, thanks for your help. We were a little worried for a moment that we have to live with that (in our case) problematic new version or stay with the outdated plugin.
    Writer for Bloculus.de the German Virtual Reality Developer Blog Professional software developer for VR, Collector of old Gaming Hardware
    Up and Coming
    October 19, 2015
    In the Unity 4.x integration I could hack into the OVRProfile.cs code to change the values of eyeDepth and neckHeight to change the Gear VR head default model.

    However it is looks like that I am unable to make it work anymore with the latest Oculus utilities with Unity > 5.2.x. Even though I hard code some values in OVRProfile.cs, when I get them through the getters (eg: OVRManager.profile.eyeDepth) at runtime, the values are different.

    Does Unity built-in integration overrides this?
    Inspiring
    October 20, 2015
    Sorry, this isn't supported. However, you can move the whole OVRCameraRig around, scale it, or change the pose of OVRCameraRig.centerEyeAnchor in OVRCameraRig.UpdatedAnchors.
    New Participant
    October 20, 2015
    Does ovr_unity_0.5.0.1_lib is supposed to work on Unity 5.2.1f1 after the "#if UNITY_5_0 || UNITY_5_1" trick ?

    A lot of errors are raised, and this line does not solve them at all...
    New Participant
    October 20, 2015
    "OswaldP" wrote:
    Does ovr_unity_0.5.0.1_lib is supposed to work on Unity 5.2.1f1 after the "#if UNITY_5_0 || UNITY_5_1" trick ?

    A lot of errors are raised, and this line does not solve them at all...


    Found out I had to comment all this condition, then build the app using Direct3D9 instead of Direct3D11 when disabling Auto Graphics API for Windows in the Player Settings.
    Hope it will be helpful for other ones..
    Up and Coming
    October 26, 2015
    "vrdaveb" wrote:
    Sorry, this isn't supported. However, you can move the whole OVRCameraRig around, scale it, or change the pose of OVRCameraRig.centerEyeAnchor in OVRCameraRig.UpdatedAnchors.


    Thank you for your response. I did not really succeed to disable the head model as I wanted for the moment. However there is this piece of code in OVRCameraRig.cs that is confusing me:


    if (!correctedTrackingSpace)
    {
    //HACK: Unity 5.1.1p3 double-counts the head model on Android. Subtract it off in the reference frame.

    var headModel = new Vector3(0f, OVRManager.profile.eyeHeight - OVRManager.profile.neckHeight, OVRManager.profile.eyeDepth);
    var eyePos = -headModel + centerEyeAnchor.localRotation * headModel;

    if ((eyePos - centerEyeAnchor.localPosition).magnitude > 0.01f)
    {
    trackingSpace.localPosition = trackingSpace.localPosition - 2f * (trackingSpace.localRotation * headModel);
    correctedTrackingSpace = true;
    }
    }


    It does not seem to be necessary from now on (I am Unity 5.2.1p3) as it seems to never enter the if block where correctedTrackingSpace would be set to true.

    However this looks like the kind of code I would need to disable to head model. But as every frame the left/right/center eye anchor transforms are retrieved from Unity in UpdateAnchors method (With VR.InputTracking.GetLocalRotation and VR.InputTracking.GetLocalPosition calls) it looks like I need to compensate for the head model each frame...

    Do I need to hack around that much? With the latest semi-built-in Gear VR Unity integration I don't really understand anymore what is still relevant in OVR API and Unity VR API seems to lack of functionnality. I'd rather change the head model parameters somewhere in Unity API or Unity taking into account what it is done through the OVR API.

    Also, I have explicitly 2 cameras configured for each eye but I can't find a proper way to disable stereo rendering (so that right eye mirrors left one).

    I have tried to set Camera.stereoMirrorMode = true, or Camera.stereoSeparation = 0, but on every cameras but it does not have any effect. BTW, IMHO, I find it weird that these settings belong to the Camera class instead of a global one like VR.VRSettings, especially when you a camera for each eye.


    All these were very straightforward to do while working with latest Unity 4.6.7 and Oculus mobile sdk.

    Thank you for your input! :)
    Inspiring
    October 26, 2015
    Yes, you would have to apply the inverse of the centerEyeCamera's local pose to the OVRCameraRig's local pose. Have a look at viewtopic.php?t=26763. This is a temporary solution and we will eventually add the ability to turn off the head model for stuff like 360 video. Camera.stereoMirrorMode = true, or Camera.stereoSeparation = 0 are not related to VR and should have no effect. Hopefully Unity will remove them at some point.
    Up and Coming
    October 29, 2015
    Thank you vrdaveb, I was able to disable the head model based on your suggestions. :)
    Up and Coming
    October 29, 2015
    "vrdaveb" wrote:
    ...This is a temporary solution and we will eventually add the ability to turn off the head model for stuff like 360 video.


    Any idea on a timeline for that 'eventually'? I'm blocked from updating to any of the new versions by this, with either mixed performance or other visual errors in previous version combinations.
    Dave Buchhofer | Dev @ Matterport