creating portal effect using a render texture and Shadergraph with screen position node in VR

I am trying to make a portal effect using a render texture and shadergraph following this tutorial: Making Portals with Shader Graph in Unity! (Tutorial) - YouTube

This sets up a second camera that moves corresponding to the main cameras movements, uses a render texture to display the second cameras image onto the portal, and uses a custom shader to use the screen position rather than the position on the portal to render the texture.

Basically, I got everything working as it does in the tutorial. Now, I am trying to convert the projet to VR.
Depending on the stereo rendering mode I choose (multi-pass or single-pass), the correct image shows in either the left or the right eye, while the other eye has a big offset and doesn’t work.

Without using a custom shader, the render texture works in VR, but the problem there is that the proportions are wrong.

I have tried multiple different things and to be honest, any way to make a portal effect would be great. I can’t find proper tutorials or answered questions, because everyone seems to use different versions of unity. (I am currently working with Unity 2019.4.1, with the Universal Render Pipeline, and SteamVR 2.6.1. But I am happy to upgrade to a different version, if you think that might help)

So these are the things I have tried (if you have tips for any of them, please help me!):

  1. I tried adjusting the shader graph to work with stereo rendering. The simplified graph looks like this:

    The problem is the screen position bit, that just doesnt seem to work in VR.

  2. I tried making seperate render textures for the left and the right eye. I can’t seem to render to one eye only. In any post i have seen about this, it says that you can just select left or right as the target eye in the camera settings. But any way that i have tried this, the VR image just freezes while the game preview in unity still looks right. I have no idea why this is happening and apparently noone else has the same problem.

  3. i tried different rendering pipelines, but the shadergraphs don’t seem to work there, or it doesnt make a difference.

Thank you so much for helping!! :slight_smile:

Let me know if you need any more information…

@unity_UT0YZuSX6Lzyyg I have searched a lot on the internet. I can save you time. One day as of this post Unity offers absolutely nothing to get a single render texture with stereoscopic view using Single Instance.

But of course, there is the issue that if you want to make a relatively complex game Single Instance is practically mandatory.

The only solution I have found is also quite simple: use two cameras for each of the eyes of the HMD viewer. So, for each stereoscopic texture that we want, for example a portal, we will have to create two cameras that will track the position of the eyes in a relative way, recording the texture in two render textures that we can assign to each of the textures of a shader that unify in a single vision.

I have searched a lot on the internet. I can save you time. One day as of this post Unity offers absolutely nothing to get a single render texture with stereoscopic view using Single Instance.

But of course, there is the issue that if you want to make a relatively complex game Single Instance is practically mandatory.

The only solution I have found is also quite simple: use two cameras for each of the eyes of the HMD viewer. So, for each stereoscopic texture that we want, for example a portal, we will have to create two cameras that will track the position of the eyes in a relative way, recording the texture in two render textures that we can assign to each of the textures of a shader that unify in a single vision.