godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a Label3D node to display text in a 3D world using SDF font rendering #3219

Closed Calinou closed 2 years ago

Calinou commented 3 years ago

Note: This proposal was discussed with reduz and is probably fine to implement.

Related to https://github.com/godotengine/godot/issues/31352.

Describe the project you are working on

The Godot editor :slightly_smiling_face:

Describe the problem or limitation you are having in your project

Drawing text in a 3D world in Godot is already possible, but can be cumbersome, especially for beginners. Depending on your needs, there are two ways to go about it, each with their own limitations:

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a Label3D node to display text in a 3D world using SDF font rendering. This allows fulfilling both needs above with a single node.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Now that multi-channel SDF font rendering is merged, we can implement similar functionality in 3D by using the same principle in a dedicated material shader option. The same font resources can likely be used as well.

Billboarding should be optional (and enabled by default). It can be disabled for things such as Minecraft-style sign writing.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This can be done using a custom shader, but it's still quite a lot of work to do manually and expose in a convenient way. Nonetheless, it's still possible to develop this as an add-on.

Is there a reason why this should be core and not an add-on in the asset library?

Displaying text in a 3D world is often done throughout the development of a 3D game. Even if it never ends up being used during actual gameplay, text in the 3D world is sometimes used during level blockouts as well to denote landmarks in the blockout.

Zireael07 commented 3 years ago

Note that many games use text in 3d world for waypoints or player tags.

lentsius-bark commented 3 years ago

Another way of having text in 3D is creating an AnimatedSprite3D and setting frames according to the character you want to use. However this is super tedious as it needs loads of custom logic for anything beyond most basic and a spritesheet with a font.

Either way I am supremely excited for having a native Label3D. Diegetic UIs will be all that much easier from Godot 4 onwards thanks to these changes.

eon-s commented 3 years ago

Label3D is better than nothing but sounds very limited, games nowadays use a lot more complex UI-like elements in 3D worlds so a full Control3D/Container3D may be better than just a label, RTL3D could make more sense.

Janders1800 commented 3 years ago

Label3D is better than nothing but sounds very limited, games nowadays use a lot more complex UI-like elements in 3D worlds so a full Control3D/Container3D may be better than just a label, RTL3D could make more sense.

You can use the already existing viewports for that.

I agree a simpler more performant label3d would be great, and I think it is an enough common case to have its own node.

akien-mga commented 2 years ago

Implemented by https://github.com/godotengine/godot/pull/60386.