How to do a 3D HUD in Godot?

Godot Version

4.3

Question

I have done 2D HUD in the past, but I would like to extend the 2D HUD further. I would like to be able to do something like this:

See those 3D HUDs? I believe all these HUDs need to be rendered into some sort of textures first, then “applied” on to 2D Planes that look at the player. Also, at the same time, these 2D planes must always be rendered last in the frame or rendered in such a way that nothing in the game world could prevent them from being seen by the player.

So how to do that in Godot?

I would try making a curved plane in blender and exporting it. Flip it so you can use it on each side. Attach them to your player so they move where your player moves. Then create a shader to apply to each one.

It doesn’t have to be 3D. It can look like that, but in reality be 2D.

1 Like

Render each image to an off-screen texture. Each of your 3D displays can be a 3D plane with the albedo_texture set to the off-screen texture. The planes are parented to the 3D camera, and placed at a constant position relative to the 3D camera. They will always appear at the same place in the scene.

To get them to not be obscured, disable each material’s depth test.

1 Like

Another alternative would be using SubViewports, positioning their content in 3D world (either via Sprite3D or plane) and making them visible only to player camera (in visual instance property editor I believe)

1 Like

@soapspangledgames What is the name of this off-screen texture? This is so I could Google it up and check in the documents.

Or is there some example codes for this?

It is using SubViewports to render a 2D scene onto a texture. Normally, the 2D scene would be overlaid onto the display, but I move the scene WAY outside the camera range so it’s never seen by the player.

1 Like