Download

2D HUD Overlay in VR

We are aware of the best practices (that recommend using 3D HUD elements or elements in world-space to communicate game stats and infos). However, we NEED to have a 2D HUD. So, we tried various approaches, but to no real avail.

I believe that the most obvious approach would be to have the same overlay HUD image displayed for the left and the right eye (i.e. where the HUD elements are on the same X/Y 2D position for both eyes). So, we tried what was suggested by “Rudy Q” in this thread (scroll down a little - Is there a way to link specific posts instead of threads?) with a VR HUD widget and a master widget that doubles the HUD view, but ran into several issues regarding scale and position of the HUD elements.

Long story short: Are there any best practices for displaying 2D HUDs on HMDs? We noticed that UE4 engine stats (such as “stat FPS”) and other engine messages are displayed correctly as a 2D overlay… but we failed to render our HUD in a similiar way.

Any help is appreciated.

I would look into either using the VR Stereo layers or try and use the Text Render actor to display the needed information.

Thanks for your reply. Due to its great practicability, we use UMG to create our UI elements. AFAIK, VR stereo layers don’t work with UMG… ? Or maybe there’s some way to make it work with UMG, we aren’t aware of? Also, our HUD is too complex to use text render actors.

Basically, our 2D UMG HUD is already done and ready to be used on normal displays… We just look for a way to use that HUD with HMDs.

Also, when following the method as described by Rudy Q (doubling the HUD view), we ran into the weird issue that the resulting HUD changed its dimensions, depending on how the game was launched in the editor. If you start it via “Play as VR Preview” , the resulting, doubled HUD has the dimensions as outlined in blue on the attached. If you “LAUNCH” the game (the button right to Play VR Preview), the doubled HUD has the dimensions as outlined in red. This is really odd… (and a bit frustrating).

You can use existing UMG widgets in a WidgetComponent and get the render texture from it to display to a stereo layer. (or manually do the same render to target logic that the component does and send it to the stereo layer).

Then all of the existing widget rendering works as is and can be in a head locked above world UI stereo layer.

Mitch had a youtube video for blueprint world locked stereo layers derived from UMG and I have source available for an override widget component that renders in stereo layers if an active HMD is detected.

Thanks for your reply, it was really helpful. We found Mitch’s video ( https://www.youtube.com/watch?v=lxFqUDW5-fE ) and it works like a charme. There’s absolutely no lag and text is well readable. Only thing I noticed is that you have to set a static background color to which the HUD will be antialised to, instead of antialising it against the world background. But since our HUD is mainly just white, we set the background color to white too, and it looks acceptable.

Greatest thing is the total absence of any lag… Thanks again, guys!