Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Virtual Reality Support for Stereo Displays

Discussion in 'AR/VR (XR) Discussion' started by s0ldier, Aug 21, 2017.

  1. s0ldier

    s0ldier

    Joined:
    Jul 26, 2017
    Posts:
    3
    Hi Guys,

    i'm using Unity 2017.1.0f3 and a Acer H7550STz DLP Projector pulg in a Nvidia Quadro K5200 (2x SLI) and a Nvidia 3D Vision 2 Kit.
    I've created a Testproject with some spheres, cubes and one movable camera. I also activated the Virtual Reality Support for Stereo Displays (non head-mounted) and the camera's "Target Eye" is set to "Both". The build of this project look good, i'v got a stereoscopic picture and
    Code (CSharp):
    1. Camera.stereoEnabled
    returns true.

    But when i'm trying to manipulate the left and right eye's projection matrix it seems to have no effect. For instance when i set the porjection matrices as the following
    Code (CSharp):
    1. Matrix4x4 projectionLeft = Matrix4x4.Perspective(90.0f, 16.0f / 9.0f, 0.3f, 1000.0f);
    2. Camera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Left, projectionLeft);
    3. Matrix4x4 projectionRight = Matrix4x4.Perspective(45.0f, 16.0f / 9.0f, 0.3f, 1000.0f);
    4. Camera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Right, projectionRight);
    each eye should see a completely different picture but they dont. It seems they have no effect. I've tested the projection matrices with the "Split Stereo Display" option for the Virtual Reality Support.
    Further more
    Code (CSharp):
    1. Camera.stereoActiveEye
    returns always
    Code (CSharp):
    1. Camera.MonoOrStereoscopicEye.Left
    for both pictures (left and right).
    I always tested my changes with a build of the project.

    I need to manipulate the left and right eye's projection matrix for a CAVE setup. In our actual setup each video wall got its own eye pair no matter how the user turns his head (the head is tracked via kinect). When you look at any cornor the pictures of each wall do not fit together properly (see picture).
    Inexperienced user didn't notice the problem but when you spend some time in the CAVE the problem gets annoying. The solution is that every video wall (unity -> camera) share the same eyes couple and therefor i need to manipulate the left and right eye's projection matrix.

    Any help is welcome. Thanks!

    Greetings
     

    Attached Files:

  2. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I just discovered this thread. Have you solved your issue? I have a couple suggestions but it's moot if you've fixed the problem.
     
  3. mgc90403

    mgc90403

    Joined:
    Dec 24, 2013
    Posts:
    20
    Looking for a solution on this myself... Any successes out there?
     
  4. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,091
    As far as I know the projection matrix is locked by the virtual reality support. There is no way of changing this.
     
  5. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I've not used the Split VR mode, but I do use the Stereo (non head mounted) VR option and the camera stereo view and projection matrix calls were working the last time I worked on it. You need to enable the Stereo (non head mounted) and either set it as the first option or request it on the command line. If the start/resolution window doesn't give you a 3D stereo option, your not in stereoscopic mode.

    I set the perspective matrix fields manually from near, far, top, bottom, left and right frustum parameters that I calculate from an eye position and extents of a display wall. I'd suggest working the algorithm in mono using the camera projectionMatrix property to verify your algorithm. The camera gizmo will show the view frustum so you can see if it's what you expect for each eye. Then you can modify the code to support stereo.

    I don't have a sample I can post just now, but I made this video to show my students what view frustums in a CAVE setup should look like.

     
    Last edited: Mar 16, 2018
  6. HoloLens_Developer

    HoloLens_Developer

    Joined:
    Sep 12, 2018
    Posts:
    1
    Hi @mikewarren, I am trying to get my set-up to work as you have demonstrated within your video. Would be much appreciated if you could share the code/details that you have used for achieving the CAVE frustum.
     
  7. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    @HoloLens_Developer
    Unfortunately, I don't own the code and it's not an open source project. Sorry. I've started re-implementing it as part of a tutorial / article, but haven't finished it.
     
  8. BrandonFogerty

    BrandonFogerty

    Joined:
    Jan 29, 2016
    Posts:
    83
    Camera.SetStereoProjectionMatrix() will only work when using multi-pass rendering. If multi-pass is not used for the stereo rendering mode, set in the xr player settings, then the vr device will force its own projection matrix.
     
  9. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    @BrandonFogerty

    Is this a limitation in Unity or some underlying graphics API?
    And, is it true of all graphics APIs (D3D, OpenGL, etc.)?
    How does this apply to non HMD stereo devices like projection wall where there is no device specific projection matrix?