Forum Discussion
ryahata
11 years agoHonored Guest
Changing Rift viewport and rendering cameras after the Rift
Our project has a requirement that we display content in the Rift, and different content to one or more additional displays connected to the same PC.
For previous versions of our project built with the older SDKs (0.2 and 0.3), we achieved this by creating a very large Unity player (eg, 1920x1080, for a 1080p viewport above the 1280x800 DK1 viewport). We used a script to reposition the draw rect for the left and right eye cameras, and our 3rd … nth cameras, and to make the window chromeless (“borderless fullscreen”).
The new DK2 0.40 SDK presents some problems for us -- it seems that we can’t easily resize/move the OVR eye ports around in the window or draw additional cameras. The OVRCameraController seems to cover any additional camera draw rectangles with a black mask. This is not ideal. Anyone have any thoughts on overcoming this limitation?
For previous versions of our project built with the older SDKs (0.2 and 0.3), we achieved this by creating a very large Unity player (eg, 1920x1080, for a 1080p viewport above the 1280x800 DK1 viewport). We used a script to reposition the draw rect for the left and right eye cameras, and our 3rd … nth cameras, and to make the window chromeless (“borderless fullscreen”).
The new DK2 0.40 SDK presents some problems for us -- it seems that we can’t easily resize/move the OVR eye ports around in the window or draw additional cameras. The OVRCameraController seems to cover any additional camera draw rectangles with a black mask. This is not ideal. Anyone have any thoughts on overcoming this limitation?
23 Replies
Replies have been turned off for this discussion
- WancyLiuHonored GuestI am having the same problems.
Still looking into the source codes for ideas. - AnonymousDoing the same thing.. looks like they've started to locking things apple's style :?
But overlaying camera is not a problem, just change the depht of the camera and you're all set; however,
the impossibility to resize and move the ovr cameras is massively annoying, it used to be perfect for anyone who
tried to do a secondary screen with a single camera mirroring and or additional information,and they've also locked resolution and the dialog box...
I don't know why but to gain few millisecon in latency, they screwed up all the best we had with the dk1\sdk :shock: - slightlyrecklessHonored GuestAlso looking into this as well would like to create a larger separation between the right and left cameras, but as soon and the prefab is run the separation is reverted back to 0. Keep us posted if you guys find anything.
- vrdavebOculus Staff
"ryahata" wrote:
The OVRCameraController seems to cover any additional camera draw rectangles with a black mask.
This sounds like a bug. We should only be clearing and rendering to the OVRCameras' original viewports. I'll see what we can do about it."ctaylor9" wrote:
would like to create a larger separation between the right and left cameras, but as soon and the prefab is run the separation is reverted back to 0.
In most cases, this will cause an incorrect relationship between the inter-pupillary distance and the neck model, which can make users sick. I would recommend scaling the OVRCameraController GameObject instead. However, if you really need to change the IPD, you can still do it in your script's Update() method. - vrdavebOculus StaffWe currently clear the entire render target and then draw to the original Unity viewport with the assumption that its position was 0, 0. It would be non-trivial to clear only a smaller viewport inside the render target, especially if you are using DX11. To add another viewport in addition to the VR view, you will need to render to a texture and then draw a quad where you need it after our distortion rendering finishes. You can draw the quad in a callback that you register with ovrHmd_RegisterPostDistortionCallback(..). You should probably do the render-to-texture before the callback (with a Unity camera or render event) to minimize latency. Hope that helps.
- slightlyrecklessHonored Guest
"vrdaveb" wrote:
In most cases, this will cause an incorrect relationship between the inter-pupillary distance and the neck model, which can make users sick. I would recommend scaling the OVRCameraController GameObject instead. However, if you really need to change the IPD, you can still do it in your script's Update() method.
vrdaveb,
Thanks for the response. Unfortunately setting the IPD manually in the update of my script didn't seem to change anything. To give you a better idea, I am trying to feed two live video feeds into the rift. I have the two separate video feeds playing on two different planes via the Webcam texture. I am trying to work with the prefab and make it so only one eye can see one plane at a time. I was able to accomplish this in SDK .2.5 by simply changing the positions of the left and right cameras(children of OVRCameraController). This approach is not working with sdk .4. Is there a different approach I should be taking? Again, thanks for the help.
Chris - ryahataHonored GuestThanks for the help vrdaveb. I have a few more questions for you :D
"vrdaveb" wrote:
You can draw the quad in a callback that you register with ovrHmd_RegisterPostDistortionCallback(..).
1) Is there documentation on the C++ stubs that I can call from within Unity? I didn't see any refs to this particular method in the Unity SDK. I would like to know the header of the method so I can reference it in my Unity script.
2) Calling OVR_SetViewport(0, 0, 1920, 1080) doesn't consistently work if the Unity window is larger than 1920 X 1080 when running in DX11 mode (DX9 works fine). I noticed that I first have to run the game as 1080p, close it, and then run it again at some larger resolution (in this case 3840 X 1080). Any subsequent runs need to follow this process if I want the Oculus viewports to render.
Again thanks for the help. - vrdavebOculus Staff
"ctaylor9" wrote:
Unfortunately setting the IPD manually in the update of my script didn't seem to change anything.
That is odd. You are using OVRCameraController.SetIPD(..), right? It may be getting overwritten by other scripts, such as OVRMainMenu."ctaylor9" wrote:
I am trying to work with the prefab and make it so only one eye can see one plane at a time.
Another way to do that is with Camera Culling Masks. You could make two layers, one visible to each eye, and then put a plane in each layer. There are other approaches, too, such as enabling/disabling or swapping materials before each eye renders or using Graphics.DrawMeshNow(..)."ryahata" wrote:
Is there documentation on the C++ stubs that I can call from within Unity?
The entire Oculus C API is exposed in OVRHmd.cs. There is some code commenting in there, but the full version is in the native SDK's OVR_CAPI.h header. We are working on an HTML reference manual to share."ryahata" wrote:
Calling OVR_SetViewport(0, 0, 1920, 1080) doesn't consistently work if the Unity window is larger than 1920 X 1080
OVR_SetViewPort(..) is an internal function that I wouldn't recommend calling from your app. To render additional viewports with good vsync behavior, you probably need to write some Win32 code and set up your own windows and swapchains instead of over-sizing the VR window. - slightlyrecklessHonored Guest
"vrdaveb" wrote:
That is odd. You are using OVRCameraController.SetIPD(..), right? It may be getting overwritten by other scripts, such as OVRMainMenu.
Yup that is what i was using. Here is the script I was trying to use.
using UnityEngine;
using System.Collections;
public class Set_IPD : MonoBehaviour {
public OVRCameraController other;
// Use this for initialization
void Start () {
other = GetComponent<OVRCameraController>();
//Debug.Log (other.IPD);
other.SetIPD (10.0f);
}
// Update is called once per frame
void Update () {
other.SetIPD (10.0f);
//Debug.Log (other.IPD);
}
}
I will try the culling mask that seems like an easier solution.
Thanks again,
Chris - slightlyrecklessHonored Guestvrdaveb,
Culling mask were the way to go! Thanks for the tip!
Chris
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 1 year ago
- 1 month ago
- 2 years ago