How to target different contents for each eye? #263
Comments
In the native Unity integration, a camera will be able to target a particular eye. In this case, your scene would have one camera per eye, and you would use layer masks to tweak the content that is sent. |
How is native Unity integration different from GVR Unity SDK? Where can I find more information about native Unity integration? If we use native Unity integration, can we still make use of some of the GVR features like spatial audio? Sorry for asking so many questions as I don't know what is native Unity integration. |
These are great questions. The SDK is the "API" for GVR and Daydream development in Unity, and all GVR features will remain as we migrate to the editor with native integration. If you look in our SDK, you'll notice that we include a native GVR library. Native integration means that Unity will call that from the editor, instead of us having to call it from the SDK level (as we currently do). This results in low-level and rendering optimizations that will make your app more performant. Hope that helps! |
The native integration for Daydream is very similar to what exists today On Wed, Jul 13, 2016 at 6:15 PM, Mira Leung notifications@github.com
|
Thanks for the explanation @miraleung! Does it mean for now, before the fully integration, if we want to render different contents to different eyes, we should update the auto-generated Main Camera Left and Main Camera Right's Toggle Culling Mask with specific layers through scripts? If so, should it happen in Awake() or Start()? |
In the end, I accessed the Main Camera Left and Main Camera Right in Update() and update the culling masks manually. Looks hacky but works, below are the codes and hope it helps someone who has same needs. ` public class CamLayerManager : MonoBehaviour {
} |
Here's a nicer way to do it without all the magic Strings. public class EyeLayerCull : MonoBehaviour
}` |
Indeed! Thanks for sharing! |
To make steffkelsey's code have an effect, you have to call |
Thanks FrogsInSpace! I updated the code snippet adding in that change. |
Is this supposed to work for Daydream as well? I am trying to use the script above in "Unity Daydream Preview 5.4.2f2-GVR12 (64-bit)" to do per eye culling. It works in the editor when testing, using the emulation. So how do you do this for Daydream? |
Good question! I don't have time to try it atm. I am not sure how much the Daydream stuff differs from Cardboard. You would think they would be the same? If I get a chance to try it this week i'll let you know. |
Hi, thanks for the reply! :) I fiddled a few hours with this yesterday, turns out it does differ from the cardboard and how the "emulation" in unity works. Which I found was quite confusing.. For future reference if anyone finds this thread, the solution for Daydream was to make 2 cameras(one left, one right), put them inside the GvrViewer and set the "Target Eye" for each one to Left/Right. And then set up the Culling Mask for each camera. But you won´t see it working correctly inside Unity(using the emulation), but you will see it working on the Phone/Daydream. |
AHHH I'm so glad I found this. @oosmoxiecode , thanks so much for your explanation-- I've been struggling with how to do this on daydream for a while now. Finally it's working! And just to further clarify, for anyone who is now finding this and trying to do the same thing, these are the steps: (mind you I'm using Unity 5.4.2 GVR-13 so maybe it's different in 5.6):
Ta-da! Yes indeed it does not look right in Unity but it does in Daydream!! |
I can't get this to work on 5.6.b11 . |
@eyalfx - instead of dong FindObjectsOfType, try building an array with GetComponentsInChildren< Camera >() |
Thanks ibrews. I tried that first and there were no cameras to be found under the main camera. Which is why I tried FindObjectsOfType to see if there are any other cameras in the scene (anywhere)... but there are none. really strange how there are no other cameras for stereo rendering. |
Maybe you're misunderstanding the solution being discussed in this thread. You need to add the left and right camera manually within Unity-- if you want this to work you can't let google do it's automatic camera adding to the main camera like it normally would. |
I know this worked for you on 5.4, but did you happen to try it on 5.6 ? |
gotcha. no I haven't tried this on 5.6 yet. |
For people trying to play 360 stereoscopic video in Cardboard, I got this working in Unity 5.6 over at issue #511 |
#570 |
With v0.8.5, GvrEye now becomes Legacy. How can we target different contents for different eye? One usage for this is playbacking 3D videos. The video for left eye will be slight different from the right eye.
The text was updated successfully, but these errors were encountered: