Search Unity

Multiple camera layers in Unity using SteamVr

Discussion in 'AR/VR (XR) Discussion' started by Jelverine, Apr 21, 2016.

  1. Jelverine

    Jelverine

    Joined:
    Jan 29, 2014
    Posts:
    6
    Hi all,

    At the bottom of this page, if you search for "Camera layering:", this is described as fairly straight forward:

    https://github.com/ValveSoftware/openvr/tree/master/unity_package/Assets/SteamVR

    I can get my 2 cameras drawn to the hmd, but the depth information seems to not be taken into account? In the standard Unity preview window I see my desired result, but in the hmd the depth of the cameras is the wrong way round.

    Has anyone solved a similar problem or can point to any useful docs please?

    Thanks!
     
  2. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    I'm having an issue with this as well. I'm not clear how to set this up. Should the 2nd camera have all the Steam_VR scripts on it? The camera just auto disables when I run the game.

    -Matt
     
  3. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Has anyone set up layered cameras with Steam VR? I'm still getting strange results. A simular setup is working fine with the Oculus.
     
  4. getwilde

    getwilde

    Joined:
    May 4, 2016
    Posts:
    18
    Last edited: May 22, 2016
    slims likes this.
  5. slims

    slims

    Joined:
    Dec 31, 2013
    Posts:
    86
    GetWilde, your solution did not work for me. I am trying to make a 3D skybox, but when I set the Clear Flags to Depth Only on the eye camera, it does not work. The resulting texture does not take into account the sky box camera.

    I followed your instructions, made a left and right eye camera, but this did not appear to have any effect. Any ideas?
     
  6. danksky

    danksky

    Joined:
    May 23, 2017
    Posts:
    2
    This problem persists. I still cannot find a way to have a layer consistently render above any other layer for the HMD.
     
  7. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    This now works in 5.6
    -Every camera must have a steam VR_Camera component
    -Set Clear flag to depth only
    - Set depth accordingly

    Camera set to render on top of everything else.
    upload_2017-6-27_19-36-9.png
     
  8. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668

    Thanks for the info! Helped me out.

    One thing to note, as of 2019.7 all you need is:
    • Clear flag to depth only
    • Set depth
    • And of course the correct culling mask (layer

    You do NOT (at lease in my case) need the steam vr camera component
     
  9. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I might be partially right/wrong here. Even though you don't specifically have to add the VR camera component, something is still controlling it, am pretty sure it's SteamVR doing it. I see that the camera is being moved with the HMD. It appears to be just doing the movements. But does anyone know if all that it is doing?
     
  10. maxizrin

    maxizrin

    Joined:
    Apr 13, 2015
    Posts:
    20
    I have the same issue with a Magic Leap (AR) project.
    All cameras in the scene are moving with head position and rotation, with no additional components added to those objects.
    I'm trying to render to render texture, I gave up on layering effects because they only render to one eye, which is another problem altogether.
    Is this a bug?