Tutorial recommendation for aircraft-style HUD

Hi, so I am still busy developing other aspects of my game and did not try out a whole lot more with the HUD. But I learned a couple of things:

Drawing the HUD

I am still playing around with NativeDraw and a couple of helper functions to draw basic shapes (and bezier curves). I haven’t managed to make them look nice. They lack anti-aliasing. I will have to switch to 4k images. And even the most basic lines, I am going to produce in GIMP.

To me, this is a major pain. No clue how quickly I will get to a beautiful HUD. I am lacking experience in this kind of 2D graphic design. And thus i still need the tutorial. Maybe a simple “making a HUD in unreal” will still be useful to me.

I do think, however, that this is quite a design challenge. Right now my HUD looks amateurish. Reducing everything to green lines is quite a constraint.

Projecting points from 3D world to 2D

there is the simple case, where I place a HUD highlight on top of a 3D world actor that flies across the screen. Think of a green circle around an object you can target. In that case you can just use one of APlayerController::ProjectWorldLocationToScreenWithDistance or UWidgetLayoutLibrary::ProjectWorldLocationToWidgetPosition. I prefer the former, because the second one does stuff that I don’t understand. The second one also correctly deals with your viewport scale, which you need to apply manually with the first one.

Projecting whole meshes from 3D to 2D

Sometimes you are not done just projecting a point. I successfully set up a SceneCapture with a RenderTarget that I then show in a widget as material. I have the SceneCapture render only one whitelisted components, using

USceneCaptureComponent::ShowOnlyComponent and ESceneCapturePrimitiveRenderMode::PRM_UseShowOnlyList.

The render target covers the whole screen and needs to adapt to changes in the screen resolution. The result is a 3D mesh rendered flat on the HUD. In my case, the 3D mesh is a splinemesh that visualizes a trajectory of a floating object. Rendering the spline mesh inside the 3D world kills immersion.

I tried to construct the same visual effect in the HUD by calculating the 2D trajectory from the 3D SplinePoints, then using native paint to render it - but this turned out practically unfeasible. I got close but there were too many edge cases and my HUD trajectory was jumping around at times.

Project the HUD on a curved window/visor

“Project” here means a real-life optical projection.

I achieved a decent curved effect using a UV transformation with the RetainerBox widget. The problem, however: When you put the “curved UV transformation” on top of your widgets, you loose control over the exact position of widgets relative to the 3D cockpit. E.g. drawing a straight line in your HUD becomes a major headache. Drawing a proper curve that follows some window frame of your cockpit is suddenly impossible. “So why don’t you just apply the curved transformation on some of your widgets?” you ask. Well one of my widget is an arrow that follows some target when the target is off-screen. This arrow has to move along the HUD borders. Removing the curved effect on the arrow makes it jump out compared to the rest of the HUD.

I will have to see whether or not I put the curved transformation on top of my widgets (or some of them) when I put everything together.