How to render elements in VR only on the right eye

I am working on a flight simulator in VR with OpenXR and XR interaction Toolkit. I use HDRP and Unity 6000.

I would like to have an HUD for the pilot that moves with the Head.
Just having the HUD in front of the camera is very uncomfortable. Is there a way to make that better, aka are there techniques or something for that?
Planes like the Eurofighter 2000 have a HUD like that.

Another possibility is a HUD like in the Apache Helicopter. Here the pilot has a monocle like device in front of his right eye.
I tried to achieve that, but nothing worked.

What I could do was:
have an old shader, that does not support VR. Those sometimes only render on the left eye.
This worked quite good. Aiming was much more comfortable.
But it was on left eye. I need it on the right.
How can I achieve that?

In older Unity version you could set the camera to left and right eye. But in the current Version, this is no longer possible.

I think this is possible in a Shader (graph) by getting the eye index, and adding that into a lerp.
In one end sample the texture, in the other end render nothing/transparent.

My thoughts:
Usually the best way from my projects is to just have a 3D object as a child to the camera and offset it. This way it still follows the head, and when it’s to the right only the right eye should see it. This way it’s still rendered realistically.

1 Like

Works great, many thanks.

The shader lokks like this, if anyone else wants to do something similar:

1 Like

Try blinking with your left eye.

Having it only render on the right eye would lock out people with partial blindness in that eye though. Having a setting to toggle the floating hud or right eye hud would be a nice feature

you are right I can do that.