Search Unity

How to enable the stereoscopic video on the Game view?

Discussion in 'AR/VR (XR) Discussion' started by IsaacChan, Oct 15, 2015.

  1. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Hi guys, I am starting to use Unity 5 free and working with my Oculus Rift DK2, however, I am wondering if it can turn on stereoscope on the Game view on my computer screen like this photo.


    (Image from the blog of Unity 3D)

    I have read a lot of images about turning on "OVRCamera" so I downloaded in from Oculus website. After I imported the "Oculus Utilities for Unity 5 V0.1.2.0-beta" plug-in into a new project file I made, I saw that "OVRCamera" prelab files. So I deleted the pre-set main Camera, put the "OVRCamera" into the scene, but there was nothing changed in my Game view after I paused the play button. Even I went to "Edit > Project Setting > Player" and checked "stereoscopic", there was still a normal rectangle pre-view on my computer screen. Could anyone teach me how to turn-on the pre-view like this photo, please?
     
    Last edited: Oct 15, 2015
  2. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Here is the view I get on the Game view. Did I do something wrong? Please help.


     
  3. DrBlort

    DrBlort

    Joined:
    Nov 14, 2012
    Posts:
    72
    That it's something that we cannot control anymore. UT decided that for the editor we should see only one eye, the left one, I think.
     
  4. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Oh no.....
    I would like to make a 360 video player with Unity. So I would need to control the left and right eyes camera. Is there any other method to do so?
     
  5. DrBlort

    DrBlort

    Joined:
    Nov 14, 2012
    Posts:
    72
    Yes, there is. It has nothing to do with what you see on the editor while playing.

    You can project your images to two spheres, and use two cameras. Each camera should have a different target eye, and each sphere should be in a different layer that only one camera could see.

    If you have an SBS (side by side) or TB (top bottom) image, you should use two materials, each one mapped to each half of the image.

    By the way, if you plan on showing video, using MovieTexture is not really good enough. You should either make a video player as a plugin that outputs a texture (outside my abilities, sadly I can't help you there), or check the asset store for one (I know there are some, I never used them).
     
  6. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Hi DrBlort, I have tried to make two cameras, but I am still wondering how to link the cameras to the different target eyes on my Oculus?
     
  7. DrBlort

    DrBlort

    Joined:
    Nov 14, 2012
    Posts:
    72
    I've never used OVRCamera, so I can't help you directly with that, but in case you decide to use the native support, if you enable in Edit > Project Settings > Player > Virtual Reality Supported, there should be a drop down on the Camera components called Target Eye.
     
  8. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    No I cannot find the "Target Eye" component. But in the script of "OVRCameraRig" from Oculus integration, I saw there is a line:

    /// The left eye camera.
    public Camera leftEyeCamera { get; private set; }

    The problem is that I cannot find a object in "OVRCameraRig" called leftEyeCamera. So how can I link this public class into a new camera?
     
  9. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Oh my goodness I was so stupid!!! I found the "Target Eye" now!



    Thank you for answering my question :D
    By the way, I am still wondering how the link the camera object to the script?
     
  10. DrBlort

    DrBlort

    Joined:
    Nov 14, 2012
    Posts:
    72
    To link any component to a script you can either assign it in a public member on the editor, or search for it on the script.

    For example, untested (MyCustomClass is a class that inherits from Monobehaviour):

    Code (CSharp):
    1. public class MyClass : Monobehaviour
    2. {
    3.     public Camera myCamera; // Assign on Editor Inspector
    4.     public MyCustomClass myGameObject; // Assign on Editor Inspector
    5.     public Transform myTransform; // Assign on Editor Inspector
    6.  
    7.     private MyCustomClass mySecondGameObject;
    8.  
    9.     void Start()
    10.     {
    11.         // Assign searching by name;
    12.         mySecondGameObject = Find("Object name in scene").GetComponent<MyCustomClass>();
    13.     }
    14.  
    15.     /// ...
    16.  
    17. }
    You can also find Scene objects searching by Tag, but I never did that.
     
  11. IsaacChan

    IsaacChan

    Joined:
    Oct 14, 2015
    Posts:
    10
    Thank you so much!!! ;)
     
    DrBlort likes this.