3D HUD Discussion?

I’ve reached the point where my game really needs a true HUD. All my in-game information so far has been an ugly mix of AddOnScreenDebugMessage() and UE_LOG(), which get the job done during development, but are not at all suitable for the finished product.

The ideal end result would be something like this:

Obviously, something that sophisticated would take a ton of work, but I’m just looking for a discussion on how to even start on this task. The big requirement here is that the HUD elements themselves are actual 3D objects, as opposed to a pure 2D HUD that is commonly seen in UE4 projects, for example:

I’ve tried to do my homework on this, but I’ve found surprisingly little info. I’ve seen a few blueprints examples that draw text on a texture, but the only C++ I can find are these:
Answerhub 332976
Answerhub 338367

Those suggest using a “Canvas” to render text to a texture, which would be a start. But is this even the most logical approach? Would Slate or UMG be better? Can they even do 3D elements? I’m hoping for someone awesome to jump into the thread with working examples with 3D elements that display text, icons, health bars, etc… This is such a ubiquitous feature in modern games that there must be some great UE4 examples.

Any advice appreciated!

I’m starting work on this now, guess I’ll post whatever progress I make. First thing I encountered is that this is pretty much incompatible with motion blur. UE4’s motion blur doesn’t discern between things that are moving with the camera and things that aren’t. So if you attach HUD elements to the camera, they instantly blur very heavily as soon as you start to move. The first thing I tried was a simple UTextRender element and it is unreadable. Thread about that is here:

Answerhub 706288

So, the first step is to disable motion blur.

The simple approach is working. I’m just creating meshes with translucent materials and attaching them to the camera at a reasonable distance. To actually draw information on them, I see two possibilities. One would be to create more geometry, like arrows, etc, and place them directly on top of the HUD elements. One hurdle there is clipping at the edges. The other approach would be to put lots of textures in the material with all the stuff you might want to draw on a particular HUD element, then use parameters to turn elements on and off and vector parameters to position them. Slightly more cumbersome, but probably makes more sense in the long run.

The engine supports 3D Widgets via Widget Components, which you can use to display regular UMG widgets. There’s no need to do all this manually with meshes and text etc!

You don’t want to use things like Text Render Actors, or static meshes for UI elements. UI should always be easy to read and you’ll generate a lot of artefacts trying to use regular objects. Slate and UMG are there for a reason :slight_smile:

Well shucks. That was exactly the response I was hoping to get a month ago when I started the thread. Sadly, I think I’m too far along now to start over on the HUD.

But the good news is that it works well using regular actors. Yes, there are some slight artifacts. I think I’m fine with them, though.

Just a couple of rectangle meshes, a couple of materials, and a text render actor.

I had to play some math games with the UV coordinates in the material to make it scroll as the player moves through space. Looks good and is smooth.

You’ll save more time in the long run if you re-do what you’ve already done. You could have what you’ve got going on there in less than a day by using UMG and 3D components.