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

Mock HMD, SetStereoProjectionMatrices, and Unity 2017.0.2 or newer

Discussion in 'AR/VR (XR) Discussion' started by neverfun, Dec 19, 2018.

  1. neverfun

    neverfun

    Joined:
    Dec 13, 2013
    Posts:
    5
    I have a custom HMD device that I can use with Unity 5.5 - Unity 2017.0.1 to create an XR application and everything looks/works correctly. Starting with Unity 2017.0.2, it does not ...

    The project setup is XR support with device set to Mock HMD. I can connect my homespun HMD to deliver all the necessary data to the application, including the hardware's correct head pose estimation, view and projection matrices for the head and each eye. Starting with Unity 2017.0.2, when I call the camera's SetStereoProjectionMatrices, the output imagery is distorted - it gets worse when you rotate away from looking straight down the Z Axis (e.g. cubes skew into diamonds). If I do not touch the projection matrices (or call ResetStereoProjectionMatrices), it looks almost right.

    As best I can tell, setting the head pose to the the camera position and rotation (directly or as a Child of another GameObject) and calling camera.SetStereoViewMatrix on the left and right eyes all still work as expected - from my testing, it is setting the projection that is the only broken step.

    Is there a demonstration/tutorial/example of the right way to manually drive a Mock HMD configured Camera for XR, in newer Unity builds? If not, any clues as to what's different about how the Camera is working underneath in 2017.0.2 and newer that might cause the projection to go wrong?
     
  2. neverfun

    neverfun

    Joined:
    Dec 13, 2013
    Posts:
    5
    So, I think this post: https://forum.unity.com/threads/change-mock-hmd-settings.565417/

    and the responses from @BrandonFogerty tell me the reasons "why?"

    If I understand correctly, my project can't move past 2017.1 because Mock HMD uses hardcoded attributes (like, fieldOfView = 111.96) that I can't change, whereas Split Stereo Display (non head-mounted) was more open/accessible to manually driving.

    I'd really rather not rewrite how the whole thing works to be a two camera system independent of XR, but that may be my only choice.