Search Unity

Can You Controll Pitch, Yaw, and Roll Per Lens via Unity?

Discussion in 'AR/VR (XR) Discussion' started by freddie_bong, Dec 16, 2017.

  1. freddie_bong

    freddie_bong

    Joined:
    Dec 16, 2017
    Posts:
    3
    Howdy folks,

    I'm trying to create apps for people who suffer from a form of visual dysfunction characterized by poor ability to achieve binocular fusion, crossed or outward turned eyes, poor balance, pain, head tilt, and a number of other symptoms I won't list at length.

    In order to help with this problem I want to put forward a view using VR technologies which can help them see what it is like to view the world normally, as well as slowly ease them into being able to do it themselves.

    In order to do this one of the things I would like to be able to do is to control the pitch, yaw, and roll of the view per lens. So that if someone had an eye which crosses in, for example, one or both of the lens could shift the view in the appropriate direction such that they would see a normal-ish view of the world to compensate for the eye turn.

    I've tested this in openGL with the occulus rift, and the physical hardware is at least capable of doing the job. I was able to successfully control the pitch/roll/yaw per lens, however opengl is significantly difficult to program complex things in at that level. I would prefer to use assets and technologies that could simplify the process, like unity.


    I apologize if this is not the appropriate forum to ask about this.
     
  2. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    If you go back to the older way of rendering two eyes (having a camera per eye) then you can easily point each camera wherever you want.

    I'm not sure if you'd be able to with single pass rendering. Possibly interfering with the view / projection matrices will give you what you're after?
     
    freddie_bong likes this.
  3. freddie_bong

    freddie_bong

    Joined:
    Dec 16, 2017
    Posts:
    3
    Hey thanks Gizmoi. Using two cameras is precisely what I wanted! I'll look into the project matrices possibility later (I tried seeing how to do this but I couldn't find a way to alter the camera script), but the camera 1/camera 2 set up will work great for me. My only fear is that since single pass rendering is more efficient unity may do away with it at some point.
     
  4. freddie_bong

    freddie_bong

    Joined:
    Dec 16, 2017
    Posts:
    3
    I hope to update this more as I go in case anyone else needs to do the same thing as me.

    It appears that direct manipulation of a camera's transform values is not possible as per https://docs.unity3d.com/Manual/VROverview.html

    Instead you must create another object as the "parent" of the camera to attach to. Then transform the location of that object, which will then transform the camera object's position.