How to modify individually the frames rendered in left/right eyes in VR



My goal is to add an horizontal mask to my scene rendered in VR (two black lines on the left and right sides of the scene in order to reduce the field of view). I achieved doing that by using a custom shader material overlaying the scene. You can see the result in the screenshot below in non-VR mode.

Now, the problem is that the VR mode renders the scene two times for each eye for the stereoscopic effect. It means that there is a black area in the middle of my scene while using a HMD (it is like having a weird black area where you would expect to have your nose).

How could I possibly overcome this problem ? Is it possible to control individually the two frames rendered for each eye and add the left mask only on the left frame and the right mask only on the right frame ?

Should I tackle this problem differently ? My goal is basically to reduce the field of view in VR.

Does this do what you need (no custom shaders used, tested with Meta Quest 2, the black mask is a mesh called zorroMask):


Edit: the above example is to be used with a VR headset only (like Meta Quest 2). In case you use a smartphone and simple VR glasses, then there is another option – just make the canvas horizontally shorter, but still centered.

1 Like