2d on 3d HUD / viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By raould
:warning: Old Version Published before Godot 3 was released.

I have looked at the Godot-Demos/viewport/2d_in_3d demo and it helped with the basic idea for me. So I put a 3d Quad into my 3d world and will render 2d into that.

But… I linked the Quad to my camera so that is nice BUT… I am changing the camera’s FOV as the game goes. That means the Quad changes size on the final screen display as the FOV changes. Which is not what I want for a HUD.

Should I change to doing 3d_in_2d instead? That way the Quad goes away and has nothing to do with the camera. The HUD becomes an real overlay, if that is possible + I can figure it out some day.

:bust_in_silhouette: Reply From: rustyStriker

you can rotate your Quad with the camera

:bust_in_silhouette: Reply From: Drachenbauer

Why a quad-mesh-instabce vfrom 3d?
You can use sprites or stuff from the control-family intead.

So you can use one of the following ways:

create a 2D-scene as your main scene and plug the 3D-game-view-scene as the first node into the node-tree of this 2D-scene
now you can place your hud-stuff in this 2D-scene below the instance of the 3D-scene.
it stays exactly positioned on your screen.

By putting your cameras in viewports you can use their view as the texture on sprites in the 2d-sccene and turn it so into a splitscreen, if you want

And here is another easyer way to build a hud:
Use only your 3d-scene, add a CanvasLayer to it and put your hud-stuff as children in there.
i tested this with a rotating camera that creates an animated 3d-scene and a button in the canvaslayer.
The button stayed perfectly fixed while the 3d-view rotates.