New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to render different objects to each eye? #146
Comments
Hi, Check: unity_StereoEyeIndex and example there: https://docs.unity3d.com/Manual/SinglePassStereoRendering.html This allows you at least in the shader to treat each eye differently. |
Cardboard SDK does not support rendering different objects to each eye and there are currently no plans to support it. However, it may be considered in a future update. |
I also want to render different contents to two eyes. I wonder which version SDK can achieve it? If I create two cameras targeted to different eyes. Do the cameras have the same position or should be separated by 6cm(eye distance)? |
If you use the GVR SDK (now obsolete for iOS) you can do so, that's the one we are using. You just need to go to your cameras and define which eye they should render; you also need to define which layers to cull, basically the left camera should not see objects in the "right" layer and the right camera should not see objects in the "left" layer. The plugin will manage the cameras position and angle |
Also interested to get this feature as soon as possible. Seems like, we can't use Cardboard XR in common case, although, we cannot use GVR with actual iPhones. Any workarounds possible? |
I am interested as well and I'm searching for a quick solution for this. Downloaded the old gvr sdk but the documentation is not too great and I am a bit stuck atm. |
It took me a while but I finally found a solution that also works with shader graph using unity 2020.2. Here is a description and some screens of the custom node I used: https://forum.unity.com/threads/render-different-color-depending-on-stereo-eye-index.1037215/ |
Does anyone know if there is a define we can use in a shader to know if 'unity_StereoEyeIndex' is valid for use? In Unity I have been using 'UNITY_SINGLE_PASS_STEREO' and 'UNITY_STEREO_INSTANCING_ENABLED' to cover most bases, but the Cardboard XR Plugin does not fall into line with these. |
Currently the Cardboard XR Plugin display provider has single pass rendering support disabled. Now that OpenGL ES 3 is supported by the SDK this flag should be able to change to true (see cardboard/sdk/unity/xr_provider/display.cc Line 108 in 4382d95
Patches here are welcome. |
This might be a stupid question, but how can I test this? I guess I would have to compile the Unity XR plugin, how? Also, would you expect this to work on the upcoming release that would work on Metal / iOS / Unity 2020? Edit: |
Thank you very much. I was able to rebuild the SDK for iOS. But I am still confused about
So the SDK has only multipass enabled right now, is that correct? (Edit) I built the binary with |
Correct, setting it to
IMO, the best way to debug this is by using the Frame Capture Debugging Tools in Xcode. You should be able to notice whether the rendering is being performed on a single pass or multiple passes. Hope this helps. |
Anyone able to replicate this in Unity 2022.2 with URP? Does not seem to work |
rendering_caps->noSinglePassRenderingSupport = false; |
Is changing the above from true to false, actually enable single pass (multiview) rendering in cardboard SDK or there are other changes/missing code that is needed? (OpenGL ES 3.2 or Vulkan)? Thank you, in advance! |
I want to be able to show different objects in each eye in Android/iOS.
In the now obsolete sdk it was possible to set a different target eye to each of two cameras and you could control which object were rendered with the culling mask property. With the new cardboard sdk whenever I try to get the same result I either end up:
I believe this happens when I enable the checkbox "Virtual reality supported" under Player settings -> XR Settings (since this checkbox is needed to enable the target eye field in the cameras)
The text was updated successfully, but these errors were encountered: