for my very first VR app I’m trying to build a simple VR Player in Unity based on the Oculus-SDK.
I’m roughly following the workflow explained here:
So, simply put:
2 spheres playing left and right eye perspective with 1 OVRCameraRig inside
left/right eye sphere assigned to left/right camera anchor via layers
left camera only sees the sphere with the left eye movie etc
yay, it works!
BUT:
Any additional objects, eg. UI polygons, inside the overlapping spheres appear 2D in VR glasses.
It’s probably because the camera(s) are at the exact same geometrical position and the actual 3D is achieved by showing different perspectives in the movie itself.
Of course I would like to have a proper stereoscopic appearance for my UI objects.
But how would I do that, Rick? C’mon… I’m - I’m just a boy Rick. I need - guidance! Put away the bottle and help me!
Make sure your scene has no redundant skybox or other bgnd stuff.
Put your real objects in the scene as normal, one instance of each object.
Turn off zwrite on your minisphere material shader.
Make minisphere material render queue be lower value than your real 3d objects render queues.
This way you can position real objects at any z depth relative to the speheres, put them right in the 3D VR movie.
For interactive unity UI canvas on a real 3D mesh, it’s probably possible, but I’m not sure because I rolled my own UI library using Texture2D, it’s one draw call for all gui screens:
UI pic
We’ve developed VR Eye Shaders so that ‘two spheres’ are not required. I’m not sure if this will fix your issue, but only having 1 sphere can obviously be beneficial .
Thanks for your help
I realize now I’m still very unexperienced with unity so I did not entirely understand your answer.
To me this sounds like a solution to have objects visible even when they’re far behind/outside the sphere? Would be quite useful for me as well.
However, currently I’m putting objects inside the sphere, which works, but the objects aren’t rendered stereoscopically.
Sorry if I’ve got you wrong here, feel free to nudge me in the genereal direction of a relevant tutorial or something, you don’t have to explain every basic thing to me
Solved it, or should I say, there was never really anything wrong.
In the tutorial, the spheres were scaled very high (100), perhaps to minimize the relative disparity of the stereocams versus the two movie spheres. So, I scattered objects inside the sphere in a way that seemed appropriate for it’s size. That must’ve been too far for a noticable stereoscopic impression. Now I’m putting them closer to the cam, everything’s fine.