Forum Discussion
abp_dk
10 years agoHonored Guest
How to combine/composite cameras in a VR scene?
I am working on a scene that renders selected parts of the scene in high detail via viewport clipping. I am doing this using 2 cameras. One camera renders the full scene in low detail and another rend...
vrdaveb
10 years agoOculus Staff
"abp_dk" wrote:
Is it possible to do camera compositing/combining in VR using the 'integrated VR support' in Unity
Unity 5 treats the VR eye buffers similarly to the non-VR backbuffer. To reduce latency, it also updates the eye cameras' transforms on the render thread, just before submitting commands to the graphics driver. In the future, we may add support for per-Camera renderscale, which would make it easier to do what you're proposing. Today, you can render to multiple RenderTextures, but there isn't a way to make the low-resolution images line up perfectly with the high-resolution ones. There will be some slight wobble in the low-resolution images (which might not be very noticeable). Screen.width and Screen.height correspond to Unity's main-monitor window, not the eye buffers. So the low-resolution eye buffer(s) resolution should be completely independent of those. I would suggest using a square texture like 512 x 512. But make sure to use the same FOV and aspect ratio as the VR Camera (the one where targetTexture == null). You can then blit the RenderTexture(s) to the eye buffers using Graphics.Blit or Graphics.DrawMeshNow.
"abp_dk" wrote:
What is the correct procedure for doing camera compositing/combining when doing VR in Unity using the OVR package from Oculus?
OVRCameraRig is a layer on top of Unity's built-in VR support, so the same recommendation applies. You might have more luck splitting the scene into near and far content, where one VR camera renders the near content at a high LOD and another VR camera renders the far content at a lower LOD. The far camera renders first and both cameras target the same eye buffers, without using any special RenderTextures. An example is in our SDK examples under "Layered Cameras". This is currently the only way to get both cameras to line up without significant wobble.
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
- 1 year ago
- 2 years ago
- 2 months ago