Output to VR and 2D monitor simultaneously?

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!

1 Like

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.

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.

1 Like

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!

3 Likes

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 :wink:

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?

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).

I got onto 5.4 and it worked just like you said, thanks! :slight_smile:

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 ?

1 Like

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?

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.

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 :slight_smile:

2 Likes

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.

1 Like

It was missing this, now it works, thanks!