Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Output to VR and 2D monitor simultaneously?

Discussion in 'AR/VR (XR) Discussion' started by laserlancer, Jan 30, 2016.

  1. laserlancer

    laserlancer

    Joined:
    Nov 9, 2013
    Posts:
    1
    Hello!

    I haven't seen this done before, but is it possible to output one camera to a VR device, and a secondary camera to a monitor in the same instance of the program? I want to make a local multiplayer game where one player uses VR and the other has a different view/interface and plays on the screen.

    Thanks in advance for the help!
     
    joaoborks likes this.
  2. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    488
    You would require a very beasty machine to run both your VR content at 90 FPS and render completely different content simultaneously (or very simple visuals).

    I'm not sure if this will work, but you could play with the targetDisplay property of the second camera. I'm not sure if the HMD is actually seen as a different display by Unity though, considering that the camera gets rendered to both a monitor and the headset simultaneously automatically.
     
  3. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,123
    With NGUI we show UI content which only appears on the monitor, not in the VR headset (at least Oculus). So I suppose you could also render to texture and replace what is on the monitor with a UI render texture but it would indeed stress the PC.
     
    JPaulMan likes this.
  4. Chromega

    Chromega

    Joined:
    Jan 21, 2013
    Posts:
    1
    I'm also working on a game that does just that, glad that others are excited about vr asymmetric local multiplayer. A quick video of my game for context:


    In our game, one player is in 3D, and the other player has a map. The magic bullet here was OVRMirror:
    https://www.reddit.com/r/oculus/comments/2occwn/ovrmirror_enables_your_apps_can_display_mirror/

    The source for this is open, which is awesome - I had to write some custom tweaks to make it be borderless fullscreen, properly handle mouse and keyboard input, and handle changing resolutions a bit differently. But maybe the vanilla version is good enough for you.

    It allows you to have a camera that you render to a texture, and then that texture is displayed on an extra window. Voila!
     
  5. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    Asymmetric multiplayer is definitely fun and possible - here's a 6 months old video I did to show how I approached this for creating gameplay videos for Holodance:


    Back then, this was not possible with Unity's native VR integration - but I've been using the SteamVR Unity Plugin all along (Vive is my primary target platform). Meanwhile, I think since Unity 5.3, you can select which "eye" a camera shall render to when "Virtual Reality Supported" is checked. If you select "None", it renders to the main screen. So that's what I'm using for PSVR ;-)
     
  6. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Has anyone had this work for Vive? I followed these steps with SteamVR + Vive:

    > Player Settings > Virtual Reality Supported
    > Go to a camera > Target Eye > None (Main Display)

    Then when I run it, it gives me an error, something about "Oculus not initialised".

    Well of course Oculus isn't initialised, I'm using a Vive...

    Is this a limitation of the current version of SteamVR? Is there a workaround?
     
  7. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    Which version of Unity are you using? IIRC, they did have this in earlier versions of Unity (5.3) but not more in 5.4 (current betas). Oh, and are you using the SteamVR plugin? If not, you have to make sure that OpenVR is used for VR, instead of the Oculus stuff (and OpenVR is only available in Unity 5.4, in Unity 5.3, you have to use the SteamVR Unity Plugin).
     
  8. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    I got onto 5.4 and it worked just like you said, thanks! :)
     
  9. djkpA

    djkpA

    Joined:
    Mar 28, 2016
    Posts:
    14
    For me different display is working thanks for answers. But I also need to switch between these cameras on monitor display. I tried to change target display but it didn't worked. How can I achieve this ?
     
    JPaulMan likes this.
  10. ParameterBlack

    ParameterBlack

    Joined:
    Jun 1, 2017
    Posts:
    1
    Does anyone know if it would be possible to support multiple external displays? For instance, have one display render a first-person view of what the Vive-wearing user sees in the HMD, and a second display render out from a standard, fixed Unity camera?
     
  11. CEmory

    CEmory

    Joined:
    Nov 17, 2016
    Posts:
    3
    I'm trying to do this on PSVR, getting a separate camera to render to the TV as a sort of spectator angle. However, this method doesn't seem to be working for me, it is completely ignoring my second camera. I'm on 5.5.2p2.
     
  12. Zargi

    Zargi

    Joined:
    Jul 24, 2017
    Posts:
    1
    I would also like to know how to display one camera on the HTC Vive and one camera as 2D on the monitor.

    The user sitting on the PC should also be able to interact via interface buttons while one user is using the HTC Vive. Unfortunately I wasn't able to realize this yet.

    Reason for this setup is a medical VR application I develop at my university. The patient is using the VR and the nurse or doc can watch and directly interact via PC. This would be the easiest setup in my opinion. Otherwise I would have to create a second application which directly connects (via TCP localhost w/e).

    I'm pretty sure that this is possible but I don't know how!

    Maybe you guys have some ideas?


    Greetings and thanks :)
     
    JPaulMan and rahuxx like this.
  13. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    Setting Target Eye on the camera you want to use as a third person camera should have that camera show up on the main game Window on the screen. You might still have to change the depth in case Unity automatically puts the VR camera on the game Window as well (which it probably does), so that you have the third person camera in the foreground.
     
    joaoborks likes this.
  14. joaoborks

    joaoborks

    Joined:
    Jul 7, 2015
    Posts:
    29
    It was missing this, now it works, thanks!