Search Unity

Bug Text shadow: glitchy artifacts and cutoffs (2021.2b16)

Discussion in 'UI Toolkit' started by burningmime, Oct 13, 2021.

  1. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    I'm enthused that the team has gotten text shadows working, and generally, they look pretty great. However, there are some strange artifacts especially when combined with text outline:

    upload_2021-10-13_11-1-8.png

    There are some weird black triangles and the end is cut off sharply instead of overflowing outside the label, It also seems the bottom is cut off, it should go down a few more pixels:

    upload_2021-10-13_11-2-23.png

    Here are the styles affecting it:

    Code (CSharp):
    1. -unity-font-definition: url('../text/Resources/TextCore/ComicShark.asset');
    2. -unity-text-outline-width: 3px;
    3. -unity-font-style: bold;
    4. color: rgb(255, 255, 255);
    5. -unity-text-outline-color: rgb(0, 0, 0);
    6. text-shadow: 8px 8px 0 rgb(0, 0, 0);
    7. font-size: 55px;
    EDIT: Actually, the more I look it seems like the shadow is being constrainted to the glyph rect. See right side of the "N" where it is cut off as well.
     
    Last edited: Oct 13, 2021
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    499
    Hi @burningmime!

    Text-Shadow being constraned to the text rect is a known issue. The text geometry is not updated after adding the text effect, resulting in clipping when they overflow the text rect.

    As for the artifacts, it's the first time I have seen this. Could you try to increase the sampling to padding ratio in the FontAsset ?
    It still looks like a bug to me, so could you report the bug through the Unity bug reporter (Help/report a bug...)

    Thanks for bringing this up!
     

    Attached Files:

    burningmime likes this.
  3. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Thank you!

    Yup; the problem was I had too low padding on the generated texture. Default padding was 9, increasing it to 12 resolved the issue. Do you still want me to report it as a bug?