How to make object invisible to left eye, but visible to right eye for VR/HMD? (and vice versa)

I am using the Vive Eye Pro HMD, and would like to show different objects to each eye.

For example, let us say there is object A, object B, and object C.
I would like only the left eye to see object A, only the right eye to see object B, and both eyes to see object C.

One method I tried was using Stereo Layers. I made a Stereo Layer, set Live Texture to TRUE, and in the Event Graph, I added “Set Left Texture” and connected to it a “render target A”, and then I “Set Texture” (for right eye) and added “render target B”. Both “Set Left Texture” and “Set Texture” are connected to “Event Tick”. However, this does not work. While I can correctly see the “render target B” in the right eye, I do not see render target A in the left eye.

One easy way would be to set up masked materials that are transparent in one eye. To do it you will need to set the material blend mode to Masked. Then add a custom material node, put this code inside it and set the output to a float1.

return ResolvedView.StereoPassIndex;

Then use the output to drive the opacity output, inverting it if you want the other eye.

3 Likes

Thanks Rectus, you mentioning that made me remember Stereo Panoramic Plugin | Live Training | Unreal Engine - YouTube (Rectus’s answer should give you what you’re looking for, but that livestream might have some more info nuggets on the topic)

1 Like

Thank you Rectus_SA, your solution is simple and easy to do, and I managed to get it working in my project :slightly_smiling_face:

1 Like