Labelling controls in a cockpit

I need some general advice on how to construct a flight-sim type cockpit, especially regarding the labels above and below switches, and ON light-up buttons.

I have modeled some switches and buttons in Blender and imported them into UE4, along with a large, empty panel mesh for the actual cockpit background. I’ve created a switch blueprint which contains a switch mesh, and I’m dragging that onto the panel mesh in the editor. My plan is to use each switch blueprint to trigger events and change variables in the vehicle, like turning on the no-smoking light. I could model it all in Blender, but since my panel design isn’t set this way allows me to easily move and test the position and functioning of switches really easily directly in UE4. I’m running into a few issues with this approach, though…

How should I handle the placement of a text label above/below each switch? In my switch blueprint viewport I can create a TextRender and position it over the switch mesh, but how can I get this to line up exactly on the panel mesh? Should I just leave it positioned a tiny bit above the panel? Can I use an emissive material for the text (like a backlight in a keyboard)?

Am I on the right track with one actor+blueprint per switch/control function… and the same for feedback things like lights, lamps and gauges? These too need labels. Suggestions on how to do the labels would be great, and if there’s a better way to go about any of this then please let me know!

You can use a render target to draw text in the 3D world. Make the label part of your 3D mesh, and set a material that you control from Blueprint on the label parts. This is what we’re doing on our project.

Nice text :slight_smile:
Can you elaborate a bit more for an UE4 noob… when you say “make the label part of your 3d mesh” do you mean just have some 2d geometry floating, which’ll accept a texture containing the label? And I don’t really get how to go from a string to a texture…
I was imagining just having a string variable in each switch, which somehow gets made into a texture (or a TextRender as I am doing now) in the construction script… I’ve been looking at Font Sample and render targets and even UMG UI and to be honest I’m kinda lost…

Well there are two ways do it :

  • 2D display over the 3D mesh : put a socket on your mesh for each switch, project it on the HUD and draw there (2D Canvas or UMG) ;
  • 3D display inside the mesh : have a texture parameter on your cockpit material, create a render target, set it from Blueprint and use Canvas (HUD class) to draw text on the texture

Which one do you want ? That’s really an artistic decision there. The 2D version will be more readable but less immersive (no 3D, no distorsion, etc).

Sweet, thanks! I want the label to look as realistic as possible, so having it look like it’s been painted directly to the panel would be perfect. I will read up on Canvas and render targets and see how far I get. Thanks for the suggestions!

Until your skills are higher (assuming you don’t know what any of the previous posts really mean) your best bet is each one to be a mesh on an actor with a raytrace on “Interact” and the mesh calls whatever function the switch needs to.

I am just about hanging in there… :slight_smile:

I followed this tutorial: and managed to create a cube with some text on it. Then I set the material to Masked, removed Draw Texture and so only use the Draw Text function to write to the texture, which I use for both diffuse and opacity map. So now I have some text floating…

This leads me to the next question… how do I set the size of the canvas text rendering? Draw Text seems to render to the texture at a fixed size in pixels… I can change the size of the dynamic texture and this scales it up but it looks very low res.

Regarding the mouse action, I did get that working with an earlier experiment, using some onClicked event in the switch actor blueprint. I simply applied a small translation to the button (it was a push button) to show it in the depressed state, and toggled the visibility of a light. I guess for more advanced controls (like a rotary knob) i could have an invisible box on the left and right of the control to handle increment-decrement, would that be the right way to go?

Aha, solved the size issue by creating an offline cached font thing :slight_smile:
Starting to look like something…

This has a bit of a drawback though that the texts are only made into textures at Event BeginPlay… which means they are invisible in the editor…