- Home /
U.I. rendering multiple cameras in VR
Hello All
I want to use the Unity UI in VR to render multiple cameras that also respond to the roomscale camera tracking.
The closest example I have found is 2 minutes into this demo:
Any ideas? Thanks
~be
You can use Camera.renderTexture to get a secondary camera to render to a texture that you can then display in a canvas object that is set to World Space. If you measure the angle of incidence between your camera and the canvas element you are looking at then you can use that to adjust the viewing angle of the 2nd camera that is rendering to your texture.
https://docs.unity3d.com/ScriptReference/Camera-targetTexture.html
Answer by PeterMorris · Oct 31, 2016 at 10:09 PM
I didn't notice the view portals had parallax. In that case....
You can use Camera.targetTexture to get a secondary camera to render to a texture that you can then display in a canvas object that is set to World Space. If you measure the angle of incidence between your camera and the canvas element you are looking at then you can use that to adjust the viewing angle of the 2nd camera that is rendering to your texture.
@Peter$$anonymous$$orris Thank you! I am going to try this a bit later on today after work. I'll let you know - I appreciate your help!
~be
Answer by mrpmorris · Oct 31, 2016 at 07:31 AM
Note how the controller interacts. The images are moved without moving the narration at the bottom. I suspect these are just UI elements on a canvas in world space and no additional cameras were required.
@mrpmorris Thanks. Yes, it looks like these are UI elements in a world space canvas but ins$$anonymous$$d of displaying images they are showing what look like windows into other small animations, so you see parallaxing as you move around - this is what leads me to think they are cameras rendering part of a world while still being a flat UI screen space elements.. Yes?
How could you make this? Could a camera be a child of a panel in a canvas in world space?
Thanks for your help,
~be