Search Unity

Question UI render texture camera issue with VR headset

Discussion in 'VR' started by jeffries7, Nov 16, 2020.

  1. jeffries7

    jeffries7

    Joined:
    Jun 25, 2014
    Posts:
    59
    I'm using Unity 2019.4 + URP 7.51 and testing on an Oculus Quest.

    I'm trying to render UI into a render texture to then be displayed on a quad for a user in VR. I've tried with both world space UI and screen space - camera, both result in the same issue.

    The issue is that the camera projections are changing between viewing in the editor, even running not in VR, and then running a build on a Quest or using Oculus Link to use VR in the editor.


    As you can see in the images uploaded, the camera view is skewed at runtime. I've not got any code attached to the camera to change anything.
    I've also tested an instantiated version versus manually placed in the scene view.

    I've had this working before many times in older projects but it's rather frustrating that it's not working now.
     

    Attached Files:

  2. green-giant

    green-giant

    Joined:
    Jun 21, 2013
    Posts:
    43
    For the camera that is rendering to the Render Target, ensure that its Target Eye value is set to None. If you are using URP it is probably hidden in the inspector. Switch the inspector into debug mode and set the Target Eye value to zero.
     
    u3007303 likes this.
  3. jeffries7

    jeffries7

    Joined:
    Jun 25, 2014
    Posts:
    59
  4. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    393
  5. homoinanis

    homoinanis

    Joined:
    Sep 29, 2020
    Posts:
    7
    I have searched a lot on the internet. I can save you time. One day as of this post Unity offers absolutely nothing to get a single render texture with stereoscopic view using Single Instance.

    But of course, there is the issue that if you want to make a relatively complex game Single Instance is practically mandatory.

    The only solution I have found is also quite simple: use two cameras for each of the eyes of the HMD viewer. So, for each stereoscopic texture that we want, for example a portal, we will have to create two cameras that will track the position of the eyes in a relative way, recording the texture in two render textures that we can assign to each of the textures of a shader that unify in a single vision.