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

Label3D outline has transparency sorting issues even when it's solid color #102337

Open
Sithoid opened this issue Feb 2, 2025 · 2 comments
Open

Comments

@Sithoid
Copy link

Sithoid commented Feb 2, 2025

Tested versions

Reproducible in 4.3

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Ti Laptop GPU (NVIDIA; 32.0.15.6636) - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)

Issue description

The outline of Label3Ds has transparency sorting issues, even when the outline is set to a solid color.

In all examples below, Label3D has default settings (solid colors, Alpha cut disabled).

Exhibit A: a mesh and a Sprite3D with transparency. The labels that are drawn in front of the objects have their outline's color affected by the objects behind them, which shouldn't happen with a solid color. You may also notice that the editor's grid bleeds through the outline.
Image

Exhibit B: a mesh and a Sprite3D with a simple shader. The labels in front of the objects consistently lose their outline. The labels behind the objects may or may not render their "covered" portion depending on the camera angle (which is an issue as well), but they still lose the outline.
Image

Exhibit C: Same shader, but this time I changed the settings on the Labels. The label behind the sprite has rendering priority -1 for the text and -2 for the outline. The one in front has 3 and 2, respectively. I don't believe this to be a viable long-term solution because objects tend to move.
Image

I believe this to be something that needs to be fixed on engine level, because:

  1. otherwise the default settings provide the best visual result compared to alpha hash and discard,
  2. the user can't control the outline's rendering behavior separately, despite the fact that it behaves differently than the text.

Might be related to #77153

Steps to reproduce

Open the MRP and just fly around the scene in the editor. Or:

  1. Create a Label3D with the default settings
  2. Create a visual object with transparency. A half-transparent mesh/sprite and a mesh/sprite with a shader that writes to alpha will have different results (see the showcase above).
  3. Place the label in front of the object.

Minimal reproduction project (MRP)

label3d-outline-test.zip

@clayjohn
Copy link
Member

clayjohn commented Feb 2, 2025

See the "Transparency Sorting" section of the 3d rendering limitations page in the docs.

Label3D is transparent by default whether you use a solid color or not. It needs to be transparent otherwise it would just draw a big rectangle.

@Sithoid
Copy link
Author

Sithoid commented Feb 3, 2025

I guess this leaves two questions:

  1. Since the outline is a default feature, what's the intended use? Manual sorting by depth whenever the objects move, like in my last example?
  2. Would it help to have separate settings for the label and the outline, or perhaps a different way to implement the outline other than a second plane on the next layer? Seems like with the current implementation there's basically no way to keep the text and the outline together, since if you assign them the same render priority, they start clashing with each other.

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

3 participants