Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro How to achieve Raster font with outline?

Discussion in 'UGUI & TextMesh Pro' started by slavidodo, Apr 3, 2020.

  1. slavidodo

    slavidodo

    Joined:
    Apr 29, 2018
    Posts:
    6
    The title pretty much explains it, I cant really find a way to achieve that crispy look of bitmap fonts.

    I used to find "Outline" option in Font Asset Creator, I couldn't really find the version that removed it, To better address the issue, I provided 2 screenshots of what I'm trying to achieve!

    [Edit 1:08 AM CEST]
    Stephan mentions that it's not possible to use outline with bitmap font shader, but I'm not trying to use outlines dynamically, rather invoke the process of generating the bitmap itself with outlines.

    There is a python script for Gimp that can do that, pretty much the same concept;
    https://github.com/edubart/otclient/blob/master/tools/gimp-bitmap-generator/generate_bitmap_font.py

    Also if it's not possible, would I be able to use my own texture with predefined list of characters?

    Sincerely,
    Slavi
     

    Attached Files:

    Last edited: Apr 3, 2020
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I can look at reviving the option to add an outline when the Atlas Texture is created.

    In the meantime, you can export / extract the Atlas Texture of the TMP Bitmap font asset and then edit it in something like PhotoShop to add the outline or any other treatment to the characters. Make sure you use sufficient padding to have enough space to add that outline.
     
  3. slavidodo

    slavidodo

    Joined:
    Apr 29, 2018
    Posts:
    6
    How do I actually export/import the asset texture?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I added this option a few years ago. Just select the font asset and then use the context menu to extract the atlas texture as seen below.

    upload_2020-4-2_19-10-36.png

    Once you have modified your Atlas texture, you will need to manually assign it to some material in the debug section of the material inspector.
     
  5. fmoo

    fmoo

    Joined:
    May 31, 2015
    Posts:
    18
    Does this actually work in a way that produces a useful (e.g., differently colored) outline?

    When I tried to do this, I ended up with something like this:
    upload_2020-10-7_20-27-48.png

    For an atlas that looks like:
    upload_2020-10-7_20-32-36.png
    I tried setting these on other atlases like the "outline" one, but it produced no change.
     
    Eater_Games likes this.
  6. fmoo

    fmoo

    Joined:
    May 31, 2015
    Posts:
    18
    Ah, I figured it out: I had to change the shader to TextMeshPro/Bitmap Custom Atlas first. Looks great now!
     
  7. Eater_Games

    Eater_Games

    Joined:
    Mar 19, 2018
    Posts:
    4
    this doesn't work for me, when reloading the scene the material just disappears, but I fixed it by duplicating the font asset and changing his default material
     
    Last edited: Nov 28, 2020