Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TextTexture for 3D signs #11443

Open
RobertBColton opened this issue Dec 29, 2024 · 6 comments
Open

Add TextTexture for 3D signs #11443

RobertBColton opened this issue Dec 29, 2024 · 6 comments

Comments

@RobertBColton
Copy link

Describe the project you are working on

Heavily UI based with a lot of billboard signs with text

Describe the problem or limitation you are having in your project

I would like to add signs to my game with various text written on them.

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

There would be a special texture type called TextTexture that renders text onto it. It would make it so much easier than having to code anything or hack around with viewports. I don't know if MeshTexture is able to do this but I haven't figured out how to use it yet as its not got hardly any documentation. I have however used TextMesh but it's inefficient for simple billboards and especially if you have a lot of text plus it sometimes doesn't work with certain non-monochrome glyphs.

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

You want to add a 3D sign to your game, you would:

  1. Create a box mesh
  2. Add a standard material
  3. Assign a new TextTexture in inspector
  4. Set the text of the sign as a property on the TextTexture

Voila, 3D sign

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

Not really you have to code a viewport and make a mess of your scene since there's no directly renderable textures.

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

It's very common feature, in a lot of engines including Unity/Roblox, etc. It's important to a lot of games to just quickly slap some text on 3D signs and stuff.

@Meorge
Copy link

Meorge commented Dec 29, 2024

Is this a feature in Unity? It's been a little while now since I've used the engine, so maybe it's been added since or I've just forgotten about it, but I don't remember there being a built-in way to generate a texture with text on it.

Godot does have Label3D, which is pretty similar to a TextMeshPro object in Unity (what you might be thinking of from there).

@RobertBColton
Copy link
Author

RobertBColton commented Dec 29, 2024

Ok, that's interesting, thank you. That is extremely helpful to me.

However, I am not so sure we can't also still "break up" the implementation. I mean, there could be cases where people would like to put text on other kinds of meshes. Also, it has the advantage of letting you tile the text if needed. Although, I don't think I will personally need it at least for the time being.

For example, imagine if you wanted the sign bent or curved.

@Calinou
Copy link
Member

Calinou commented Jan 2, 2025

If you want actual mesh-based text, you can use a MeshInstance3D node with a TextMesh mesh. This will generally be slower and look worse than Label3D unless you use some kind of antialiasing with subpixel precision (MSAA/TAA/FSR2) though.

For example, imagine if you wanted the sign bent or curved.

TextMesh can achieve this if you apply a custom shader on a material override set on the MeshInstance3D node. There's an example of this in the 3D Labels and Texts demo.

@Calinou Calinou changed the title Feature: TextTexture for 3D Signs Add TextTexture for 3D signs Jan 2, 2025
@Meorge
Copy link

Meorge commented Jan 2, 2025

For a texture with text displayed on it, that you could apply to any texture-displaying object, it sounds neat but I could also imagine it scope-creeping its way up into something nearly indistinguishable from a separate Viewport.

These are some questions about the functionality I could see people asking:

  • Horizontally, can the text be left-aligned, center-aligned, or right-aligned?
  • Vertically, can the text be top-aligned, center-aligned, or bottom-aligned?
  • Can the text be placed at an arbitrary offset on the texture?
  • Can the text be rotated?
  • Can we configure how much padding/spacing is there on the sides of the text?
  • Can we set the texture's background? Can it be a texture, or a solid color, or transparent?
  • Can we set the texture or color of the text?
  • Can we give the text a shadow? An outline?
  • Can we add other textures (icons and such) within or alongside the text?
  • Can these properties/objects within the texture be animated or changed at runtime?

If these things were to be implemented, I feel like it'd more or less just be a second implementation of a Godot SubViewport and ViewportTexture.

@RobertBColton
Copy link
Author

Yeah so I'm making a city builder in Godot. One of the requirements is I am using only built in shapes to create the art, no use of Blender. I'm rendering small signs to the buildings for their billboards/advertisements. Sometimes the TextMesh will break with certian Unicode Emojis, such as the Radioactive symbol, othertimes it don't. So I'm going to try switching out to Label3D with some extruding to get around that.

Image

@RobertBColton
Copy link
Author

I'm planning to release the source to the people of Godot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants