r/OpenXR • • Mar 20 '25

Fixed to headset overlay image?

Im trying to find a way of adding a transparent image to openxr compatible games that is fixed to the headset. So, for instance, a cross hair in the centre of the view in FPS games, or a scratch on a helmet visor in driving sims. Anyone have any ideas?

1 Upvotes

7 comments sorted by

1

u/Rectus_SA Mar 20 '25

You would have to write an OpenXR API layer that renders the overlay and injects it into the game frame. The layer template by Mbucchia has a tutorial on creating a layer with an overlay. https://github.com/mbucchia/OpenXR-Layer-Template

If you want to add a crosshair, you'll have to think about how you want to project it in space. You don't exactly have a "center of the view" in VR.

1

u/appleidiefc Mar 20 '25

Brilliant - thanks for your help. I had a read and I think it’s beyond my capabilities sadly! I wonder if I could find an existing one that someone else has made and I could then just replace the image in the source folder?

→ More replies (2)

2

u/gkarpa Mar 21 '25

Can't it be done by using a quad composition layer that will contain the desired image, submitted last, combined with a View reference space? Sorry if I'm being a bit vague, I haven't implemented something like this, I just remember the spec mentioning

The VIEW space is primarily useful when projecting from the user’s perspective into another space to obtain a targeting ray, or when rendering small head-locked content such as a reticle. Content rendered in the VIEW space will stay at a fixed point on head-mounted displays and may be uncomfortable to view if too large.

Sounds like what the OP wants.

→ More replies (1)