Search Unity

TextMesh Pro Docs/SDFAA_HINTED?

Discussion in 'UGUI & TextMesh Pro' started by andyz, Apr 5, 2019.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
  2. Vee_Oh

    Vee_Oh

    Joined:
    Mar 26, 2015
    Posts:
    10
    Hey Andyz,

    I am no expert, but as far as I know you have the following "Modes" when it comes to TMP.

    SDF(Vector), Smooth(Raster) and Bitmap(Raster)
    • There is the SDF(Signed Distance Field) mode. This is essentially a vector representation of the font data that allows you to zoom in, and it will still look crisp, because it is rendered continuously as you zoom in/out, and uses math to describe the shape.
    • Then there is the Bitmap(Raster) mode, which basically renders the font like a normal sprite or texture. So obviously it will be pixelated when you zoom in. Both the Smooth and Raster options are in fact Rasterized.
    Anti-Aliasing (AA)
    The Raster fonts are not anti-aliased and will appear jagged, and the Smooth is Anti-Aliased and will appear smooth.
    SDF does not really need AA since it is a vector shape, and the anti-aliasing is 'built in' due to the greyscale map it uses to render the font.
    • Due to the nature of a Signed Distance Field you can do all the cool things like softening edges, giving it outlines etc. since the data is just a mathematical representation of the shape of the font, based on a signed(+ or -) distance from a center vector line.
    • The Raster fonts don't have these cool features, and are basically just sprites,described by a certain amount of pixels, based on the font atlas you created for them.

    Hinted & Unhinted
    Both the Raster and Smooth have Hinted versions and Unhinted versions.
    • Hinting will line up 'important' parts of glyphs better with the pixel grid to make certain parts appear less pixelated (Usually Ascenders and Descenders, Serif parts of Serif fonts etc.) because it will sit directly on the pixel grid.
    • So Unhinted fonts don't make these micro adjustments to the glyphs, but that will ensure that your Typeface 'looks' exactly the way it should, meaning every pixel is exactly where it was designed to be, not neccesarily where it looks the best.
    So that is why Hinting is better for Low-Res as you said, because there are fewer pixels available on the display, so it is neccesary to have the 'important' parts of each letter sitting exactly on a row(or rows) of pixels, instead of spilling over into other pixel rows, making it look blurry.

    So I would guess that SDFAA_HINTED simply refers to SDF(Smooth) with AA(Anti-Aliasing) that is Hinted, although I could not find this reference anywhere on http://digitalnativestudios.com, and as far as I understand SDF does not require AA.
    [EDIT] - StephanB clarifies below that SDFAA_ HINTED uses the hinted version of the font.

    "SDFAA Hinted uses the hinted version of the glyph to compute the SDF from. This usually produces glyph metrics that are INTs instead of float and may help with small point sizes although a lower sampling value also helps.

    For the most part, it can yield slightly different looking glyphs. "

    TLDR:
    • Smooth Hinted - Anti-Aliased, Raster Text with small adjustments to make it align better with the pixel grid. Might change the shape of letters very slightly, but will look better at low-res
    • Smooth - Anti-Aliased, Raster Text without adjustments to make it align better with the pixel grid. Won't change the shape of letters at all, but it won't look so good at low-res as hinted.
    • Raster Hinted - Aliased(Jagged edges) Rasterized Text with small adjustments to make it align better with the pixel grid. Might change the shape of letters very slightly, but will look better at low-res
    • Raster - Aliased(Jagged edges) Rasterized Text without adjustments to make it align better with the pixel grid.Won't change the shape of letters at all, but it won't look so good at low-res as hinted.
    • SDF 16 - Signed Distance field, 16-Bits of data, Vector Text. Can be adjusted for various effects. Always Crisp.
    • SDF 32 - Signed Distance field, 32-Bits of data, Vector Text. Can be adjusted for various effects. Always Crisp.
    As I said, this is just my understanding of how it works. I am sure the documentation will be ready soon, and that will probably explain it a little better than I have.

    Regards,

    V
     
    Last edited: Jul 10, 2020
    Jamisco, dmRicky and yutoVR like this.
  3. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Yes thanks but this is what I don't get! It builds very fast but what is it!
     
  4. bedorlan

    bedorlan

    Joined:
    Aug 16, 2015
    Posts:
    18
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    SDFAA Hinted uses the hinted version of the glyph to compute the SDF from. This usually produces glyph metrics that are INTs instead of float and may help with small point sizes although a lower sampling value also helps.

    For the most part, it can yield slightly different looking glyphs.