Search Unity

very thin outline

Discussion in 'UGUI & TextMesh Pro' started by andrew_pearce, Oct 14, 2019.

  1. andrew_pearce

    andrew_pearce

    Joined:
    Aug 5, 2019
    Posts:
    9
    Hello,

    I spent couple of hours tried to understand, why outline for my font is so thin (almost invisible).

    At the same time the default sample material is displayed correctly.

    Thanks
     

    Attached Files:

  2. Lumakip

    Lumakip

    Joined:
    Oct 14, 2019
    Posts:
    2
    how large is the padding on your font asset? If your effect is super small, you may need to increase the padding from the original ratio of 5/512 to more of a 10/512, 20/1024.
    Hope this helps.
    Kip
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The effective range of material properties is determined by the ratio of Sampling Point Size to Padding.

    "11. How can I increase the range of text effects like dilation, outline, and underlay?
    The range of these effects is determined by the padding used when creating the font atlas. The larger the padding, the larger the effect range. Of course more padding means less room for character data. So there is a trade-off between character quality and effect range. Use the smallest padding that works for you. Note that the padding is specified in pixels, so if you double the texture size you also have to double the padding to keep the same range. See here and here for more details. See the following updated video about Font Asset Creation which provides information about padding and how it affects material properties and their range."
     
  4. andrew_pearce

    andrew_pearce

    Joined:
    Aug 5, 2019
    Posts:
    9
    @Lumakip thanks, I tried to change auto size (which was around 130) to 60 and set padding to 16, 32 but it did not affect result. I attached screenshots of settings which I used to create font asset.

    Thanks @Stephan_B, that's exactly the video I was following yesterday but in my case there is no outline. Since using default font asset works on the same object it means the issue is within font asset itself or material, however from editor both materials look identical.
     

    Attached Files:

  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The ability to add Dilation, Outline, Shadow, etc. is available as a result of using Signed Distance Field which are the SDFAA modes and legacy SDF16 and SDF32.

    In your case, you are using the bitmap modes like Smooth which is why an outline is not possible.

    With regards to sampling point size vs. padding. You want to target a sampling point size of around 72 or higher but less than 120. 90 is a good target. Padding should be 10% of sampling point size to give you a good effective range.

    Again, if the sampling point size is 90, then padding should be 9 for a ratio of Sampling Point Size to Padding of 10%. This is explained in the video that I linked.
     
    andrew_pearce likes this.
  6. andrew_pearce

    andrew_pearce

    Joined:
    Aug 5, 2019
    Posts:
    9
    Thanks a lot @Stephan_B, now I paid attention that in video "distance field 16" is selected. Everything is working fine now and probably it's good idea to watch the video again till the end, as he will probably explain why I should select custom font size, which you also mentioned in your post.

    One more question: why it takes more than a minute to create a font asset on my PC while in the video it's just a couple of seconds (I have 16GB Ram, Core i7 and SSD hard drive, what may affecting the speed?)
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    There is a significant difference between the various Render Modes like Smooth, SDFAA, SDF16 and SDF32.

    The SDF16 and SDF32 are very accurate but super slow and increasingly slower as the padding values increases. The SDFAA will be super fast irrespective of the padding but less accurate. The difference in accuracy is not really noticeable unless the text is displayed at larger than 72 point on screen and with a fairly thick outline.

    The SDFAA mode is used by the Dynamic SDF system by default. The Default Generation Settings for this mode are Sampling Point Size of 90 with padding of 9.
     
    andrew_pearce likes this.
  8. andrew_pearce

    andrew_pearce

    Joined:
    Aug 5, 2019
    Posts:
    9