Search Unity

Text Mesh Pro - The Ultimate Text Solution for Unity - Powerful & Flexible - Advanced Text Rendering

Discussion in 'Assets and Asset Store' started by Stephan-B, May 29, 2014.

Thread Status:
Not open for further replies.
  1. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The latest releases of TextMesh Pro for Unity 4.6 and Unity 5 are available on the Asset Store.

    (Short answer) because it can take between 7 to 14 days for new releases to get approved on the Asset Store and when Unity releases a new version of Unity like Unity 5.2 which isn't as stable as previous releases, it doesn't make sense to update the Asset Store release until Unity that particular release of Unity becomes more stable.

    (Longer answer) When Unity releases new versions of their product like Unity 5.2 where a significant part of their API changes coupled with the introduction of a larger than usual amount of bugs for which we will have to wait several weeks for them to fix which indirectly will require me to potentially release several new versions of TextMesh Pro to handle these Unity bugs and changes, it is a lot more efficient for me to release these new version to the user forum since I can get those version in the hands of my user much faster since it can take between 7 to 14 days for new releases to get approved by Unity for the Asset Store.

    Going forward, I will always release new versions of TextMesh Pro on the user forum first. Then unless some issues are reported by my users, I will proceed to update the Asset Store releases within the following 7 to 10 days. That is provided we are dealing with a somewhat stable version of Unity. When we are dealing with some new release of Unity which introduced a larger than usual amount of bugs (like in the case of Unity 5.2) then it will take longer for the new versions of TextMesh Pro to make it to the Asset Store.

    Every TextMesh Pro user should register to the user forum. Approval only take a few minutes to a few hours if I am sleeping or if there is an issue with the invoice # provided by the user. Access to the user forum isn't just for getting those new releases, it is the best place to request support and to also get access to example scripts.
     
    hippocoder likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Do I need to register? I was beta tester then bought it on asset store but afaik the same login should work? Sorry haven't really got to the point to use text before now in the game :D
     
  3. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The Hippo is still a registered member of the TMP user forum :) so your user login is still active.
     
    hippocoder likes this.
  4. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    It's faster and more flexible that way.
     
  5. Irina-uk

    Irina-uk

    Joined:
    Feb 14, 2014
    Posts:
    62
    Thank you for your work, your best plugin.
     
  6. LHMatsuoka

    LHMatsuoka

    Joined:
    Jul 2, 2015
    Posts:
    14
    Hi,
    I'm using Unity5.2.1p1 and TextMesh Pro-Unity 5.2 Beta 1c.
    Text of TextMeshPro does not appear correctly in the Mask of UnityUI.
    TextMeshPro it would not support the Mask of UnityUI?

    Screenshot_2015-09-26-07-49-50.png
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    As per the following post on the TextMesh Pro user forum in the thread for this current beta, you will find the change required to make the mask work. This is due to a bug in Unity 5.2 which this change gets around.

    Please note that support for masking is partially implemented as there are a few other bugs in Unity 5.2 which are affecting masking. Unity has acknowledged those issues which should hopefully be resolved in the next Unity 5.2 patch.
     
  8. LHMatsuoka

    LHMatsuoka

    Joined:
    Jul 2, 2015
    Posts:
    14
    Thank you. I will check it.
     
  9. ejtrowbridge

    ejtrowbridge

    Joined:
    May 16, 2014
    Posts:
    7
    Love this asset! Thank you for all your hard work. :)

    Do you have any tips on making text more crisp for Mac Retina displays? The displays have a huge DPI, and my text looks really nice on non-retina displays, but I can totally see the text degradation when I pull up the game on my retina MacBook Pro.

    I tried upping the scale factor of the atlas under the Debug Settings, which helped a bit, but perhaps you have already addressed this question somewhere?

    Thanks again!
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You should not be seeing any degradation. Are you using an SDF Font Asset? What shader is being used?

    Can you make a post on the TextMesh Pro user forum and provide me with some images showing the text object along with the inspector settings. Be sure to include the material inspector with the debug selection of the panel expanded.
     
  11. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Sooo.. any updates on the multiple fonts in one text object feature? Or did I miss the new release and it's already covered?

    Thanks and lóoking forward! :)
     
  12. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The new feature isn't available yet as the less than smooth release of Unity 5.2 has kept me busy. I am hoping that the new Unity 5.2 patch on Friday will include some of the fixes for the bugs I have reported to Unity which in turn will enable me to get a new version out where everything is working smooth with Unity 5.2 thus allowing me to resume work to get the Multi Font & Material support released.
     
  13. rutz

    rutz

    Joined:
    Aug 21, 2013
    Posts:
    51
    Is there any way to measure text how big it is in scale or dimension?
     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    There are many things that will provide a sense of dimension. The bounds, the preferred width & height, point size, length of each lines, etc... You would need to be more specific in terms of what you are looking for / use.
     
  15. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Release 0.1.52 Beta 2 of TextMesh Pro for Unity 5.2 is now available on the TextMesh Pro User Forum.

    Assuming all goes well with this release, I will be updating the Asset Store releases within the next 7 days.
     
  16. rutz

    rutz

    Joined:
    Aug 21, 2013
    Posts:
    51
    I mean Transform (x,y,z) or RectTransform (width, height) in world space. I would like to find out how wide and high it is. Then I could set those value to wrapper. You may says "you can use Content Size Fitter". I would says "YES" but it has limitation. Content Size Fitter will expand element by child element size but it is no maximum width or height. I want to limit them how biggest size it could be. If you have any method or ways to measure text width or height before render, it would be great!

    I hope you get me. <3
     
    Last edited: Oct 5, 2015
  17. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You should be able to use TextMeshPro.GetTextInfo("How long is this string"); which generates the text with the flag set to not render and then check TextMeshPro.preferredWidth;

    There are other potential ways to get the width of the text but that is one of them. It might be useful to create a thread on the TextMesh Pro user forum since that would be potentially useful to other users as well. There are also other threads there about similar questions. Search for preferred width / height.
     
  18. rutz

    rutz

    Joined:
    Aug 21, 2013
    Posts:
    51
    Thank you very much for you kindly answer. I would love to post on your forum next time.
     
  19. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Text Object Default Settings
    In the next release, you'll have the ability to define the default settings used by new text objects. This will be done via the TMP Settings.

    upload_2015-10-9_15-28-44.png
     
    hopeful likes this.
  20. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Do I have to use TMP shaders with the text? Or I can switch it with others without losing anything?
     
  21. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro uses Signed Distance Field as its primary text rendering method. This makes it possible to dynamically style the text by adding Dilation, Outline, Shadow, etc... this is all made possible by using SDF Font Assets created with the built-in Font Asset Creator and the custom set of shaders available in TextMesh Pro. So you do have to use the TextMesh Pro shaders as they provide unique functionality.

    TextMesh Pro offers a selection of shaders with varying degree of functionality. These shaders work on mobile, console and desktop platforms.

    TextMesh Pro also support bitmap fonts for which there are also shaders included. However, when using bitmap fonts, other shaders could be used.
     
  22. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Oh okay, I understand. :)

    I actually wanted to use this shader specifically for my 3D text. But if I change the render material of the default 3D Text component then it becomes blocky and doesn't render properly.

    When you said that for BMP fonts other shaders could be used, does this in theory means every shader? Or does it still require font-specific shaders?

    Sorry I don't have that much knowledge in this kind of stuff. :)
     
  23. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Unless the other shaders are designed specifically to handle distance field and work with TextMesh Pro, these shaders will not work. A good parallel would be using the normal diffuse shader designed to render opaque geometry instead of a shader designed for text.

    The TextMesh Pro Distance Field shader does support Glow and thus you should be able to create a material preset that would be pretty comparable to what this other shader delivers in terms of visual. Here are two quick examples.

    upload_2015-10-10_14-58-44.png

    A texture and beveling could be added to the text to give it the look of a neon tube.



    Text usually requires a shader designed to handle text which uses a Font Atlas texture and using the transparent rendering pass.
     
    Last edited: Oct 10, 2015
  24. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309

    How can I achieve the style ?
     
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The challenge here is with the shadow being on top of the white stroke around the letters. Since Underlay (shadow) applies after the Dilation which we would use to create the white stroke, we can't get the shadow in between those two.

    On the other hand, this is pretty easy using two text objects. The top object contains the Vertex Color Gradient (Orange) and the Shadow. The 2nd text object is white and dilated and placed under the top object. Basically, we are layering those two to create the visual FX.

    upload_2015-10-14_1-40-7.png

    P.S. A custom shader could actually be created to do this in a single text object. Right now I am trying to get a new major release out so I don't have time to create one but perhaps a TextMesh Pro user with Shader coding skills could tackle this one :)
     
  26. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    Hi there
    As you can see Text is blurry/aliasing in small sizes, i attached the project without text mesh pro for you to look at.
    There might be some settings i have to tweak? Please Advise
    RSS.png
     

    Attached Files:

  27. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    At those sizes, you want to enable Extra Padding. Using Linear Color Space instead of Gamma Space would help as well.

    Super small text is really hard to handle since you are dealing with so few pixels to represent any letter.
     
    RazaTech likes this.
  28. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I have modified the TMPro_SDF-Mobile.shader TMPro_Properties.cginc, TMPro_SDFMaterialEditor.cs by duplicate the underlay code to have a second underlay for the white outline. If you have time later, can you think about adding this feature officially later.
     
  29. KML1

    KML1

    Joined:
    Oct 20, 2015
    Posts:
    1
    Hi Stephan,
    just a quick question:

    Is there any unicode support in TextMesh PRO? We would like to display emoticons by using arial or some other font. If we tried some unicode tags, text mesh pro only displays only a red X. Is there any possibilty to get an easy emoticon support? I know the asset has the possibility to display inline graphics as 2d sprites with the tag <sprite=xx>. In order of this functionality is the only way to set up a script asset with all sprites of emoticons?

    Best regards
     
  30. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
  31. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The latest release include both support for UTF-16 "\uE2AC" and UTF-32 "\U001F0000". So as long as your font includes those emoticons, you will be able to access them.

    Here is a link to the thread about UTF-32 support http://digitalnativestudios.com/forum/index.php?topic=629.msg5567#msg5567 as well as http://forum.unity3d.com/threads/te...le-in-asset-store.227790/page-17#post-2275216
     
  32. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
  33. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hello,

    I'm trying to change character color using the following script but nothing happens. I'm certainly doing something wrong but can find out what.

    Code (CSharp):
    1. // Get a reference to the uiVertices array.
    2.        
    3.         // label is a TextMeshProUGUI instance with color and outline
    4.  
    5.         UIVertex[] uiVertices = label.textInfo.meshInfo.uiVertices;
    6.        
    7.         // Iterate through each of the characters of the word.
    8.         for (int i = 0; i < label.textInfo.characterCount; i++)
    9.         {
    10.             int vertexIndex = label.textInfo.characterInfo[i].vertexIndex;
    11.  
    12.             Color32 c = uiVertices[vertexIndex + 0].color.Tint(0.5f);
    13.            
    14.             uiVertices[vertexIndex + 0].color = c;
    15.             uiVertices[vertexIndex + 1].color = c;
    16.             uiVertices[vertexIndex + 2].color = c;
    17.             uiVertices[vertexIndex + 3].color = c;
    18.         }
    19.  
    20.         label.canvasRenderer.SetVertices(uiVertices, uiVertices.Length);
    21.  
    Any idea ?

    Thanks
     
    SuperLowPoly likes this.
  34. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using TMPro;
    5.  
    6. public class ColorChange : MonoBehaviour {
    7.  
    8.     private TextMeshProUGUI m_TextMeshPro;
    9.  
    10.  
    11.     void Awake()
    12.     {
    13.         m_TextMeshPro = GetComponent<TextMeshProUGUI>();
    14.     }
    15.  
    16.     IEnumerator Start()
    17.     {
    18.         UIVertex[] uiVertices = m_TextMeshPro.textInfo.meshInfo.uiVertices;
    19.  
    20.         while (true)
    21.         {
    22.  
    23.             // Iterate through each of the characters of the word.
    24.             for (int i = 0; i < m_TextMeshPro.textInfo.characterCount; i++)
    25.             {
    26.                 int vertexIndex = m_TextMeshPro.textInfo.characterInfo[i].vertexIndex;
    27.  
    28.                 Color32 c = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
    29.  
    30.                 uiVertices[vertexIndex + 0].color = c;
    31.                 uiVertices[vertexIndex + 1].color = c;
    32.                 uiVertices[vertexIndex + 2].color = c;
    33.                 uiVertices[vertexIndex + 3].color = c;
    34.             }
    35.  
    36.             m_TextMeshPro.canvasRenderer.SetVertices(uiVertices, uiVertices.Length);
    37.  
    38.             yield return new WaitForSeconds(0.1f);
    39.         }
    40.     }
    41. }
    42.  
    It is hard to tell why your colors are not changing since I can't tell when your code is getting executed. For instance, if it was contained in Awake(), you would be modifying the colors which would then be overridden as the text object is generated since Awake() is called on it as well.
     
  35. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I looked at those suggestions and the issue with those changes is that CalculateLayoutHorizontal() and CalculateLayoutVertical() are called by Unity which can happen as a result of changes made to a Layout Component on a parent. As a result none of the properties of the TMP object have changed and yet the layout still needs to be recalculated.

    I don't mind taking a look to see if further optimizations can be done but could you PM me with a Repro project that would enable me to see the issue when using those lists. This would spare me from having to try to reproduce this.
     
  36. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    37
    Will TextMeshPro.meshInfo allow us to determine the new size of the mesh for the TextMeshPro object when the font size for the TextMeshPro object is changed in code? (Useful when a collider attached to the TextMeshPro object must be resized when the font size for its mesh changes in code - TextMeshPro is useful for rendering not just text).
     
  37. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yes. You can either check that or the bounds of the Mesh created by the text.

    Any reason why you are adding a collider to the text object?
     
  38. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    37
    @Stephan B
    I am adding colliders to glyphs I am importing via .ttf files for use with TextMesh Pro for use as button backgrounds to be used in conjunction with 2D Toolkit's input event handling methods. I would also in the future like to use the same approach (importing 2D graphics via .ttf files for use with TextMesh Pro) for creating "resolution independent" 2D graphics.

    Edit:
    I have been unable so far to change the collider's bounds - TextMesh Pro (I think) keeps changing it to match the size of the bounding box of the text object (if that makes sense). Not sure how to do this at runtime.
     
    Last edited: Oct 28, 2015
  39. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I believe Unity is adjusting the size of the collider. However before looking into this, have you looked at this video and considered using the functions contained within instead of adding colliders?
     
  40. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    37
    @Stephan B
    Thanks for replying and pointing out the video. I am a complete noob at TextMesh Pro, and had not seen the video you mentioned before. However, to do what I want, I really do need to attach a collider to trigger 2D Toolkit's event handlers.

    Have you considered developing a tool that would use SDF technology for more than just text, for use with general purpose 2D graphics, perhaps with its own custom atlas creator/manager? You could call it something like 2DMesh Pro. It seems like it would solve the problem of resolution-independent 2D graphics but with decent performance.
     
  41. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I have but I am running into the "Not enough time in the day" to work on another tool. I am getting to the point where I would need to hire someone to help out on the development front.
     
  42. KITPUNK

    KITPUNK

    Joined:
    Nov 11, 2014
    Posts:
    13
    I just purchased Text Mesh Pro today and when using the Font Asset Creator, I get the following error

    DllNotFoundException: Assets/TextMesh Pro/Plugins/64 Bit Plugins/TMPro_Plugin.dll
    TMPro.EditorUtilities.TMPro_FontAssetCreatorWindow.OnDisable () (at Assets/TextMesh Pro/Editor/TMPro_FontAssetCreatorWindow.cs:157)
    UnityEditor.DockArea:OnGUI()


    I am using Unity 5.1.2f1 and Text Mesh Pro 0.1.5 Beta 2.2

    I looked up solutions but they were for much older versions of TMPro, the methods did not work for me.
     
  43. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Most likely you are using Windows and using an older version of Visual Studio or MonoDevelop.

    As per the patch notes available on the TextMesh Pro User Forum.

    Important Note for Windows Users: If you are NOT using Visual Studio, you will need to install the Visual C++ Redistributable Packages for Visual Studio 2013. Please download and install "vcredist_x64.exe". These dll's are required by the Font Asset Creator and sadly no longer included in Unity 5.0.

    P.S. I recommend you register to the TextMesh Pro user forum where you will have early access to the newest release as well as Tutorials, Videos and a lot more information.
     
    hopeful and KITPUNK like this.
  44. KITPUNK

    KITPUNK

    Joined:
    Nov 11, 2014
    Posts:
    13
    I totally missed that post when I was reading that thread, works perfectly now. Thank you very kindly! I did apply for the forums earlier today, was waiting to be approved :)
     
  45. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Just before replying to your initial post, I approved all pending registrations. So you should be good to go :)
     
  46. KITPUNK

    KITPUNK

    Joined:
    Nov 11, 2014
    Posts:
    13
    Got it, cheers :D
     
  47. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi,

    In trying to achieve a resolution independent UI, I'm trying to decide between using Unity's UI in "Scale With Screen Size" (with SVGs for images + Text Mesh Pro for text) and vectors using NoesisGUI.

    As part of my tests, I've been looking very closely at font rendering, and have been playing around a lot with Text Mesh Pro at very small font sizes, with various Font Asset Creator settings and Extra Padding/Dilate in the TMPro UI Text settings.

    Since I'm using Canvas Scaling for a resolution independent UI, only the SDF fonts scale well. Hinted Smooth, Smooth, Raster Hinted and Raster become unusable with scaling. Here is the best I could get with TMPro at the smallest font size I'd be using (fyi, this is the scaled Game View output at 1024x768 on a 1920x1200 screen, meaning at 1920x1200, this text would be much larger):



    Here's the font rendering with NoesisGUI at a similar font size:




    Keep in mind both pictures will be affected by the same amount of jpeg compression. While TMPro renders beautifully at larger font sizes, it's a little blurry at very low sizes, as you can see in the 2nd and 3rd lines (especially the words like "ocurreret", "nominati" and "duo"). NoesisGUI developers said that they use subpixel rendering and subpixel positioning, which may explain why the font is slightly crisper at these font sizes.

    Is there anything else I can do to get a comparable crisp font at this size with TMPro other than dilate (which doesn't help much in this case) and extra padding, which is already enabled? I tried creating the SDF asset at various sizings and with Distance Field 16 and 32, but it doesn't make much of a difference at this font size level.

    Thanks.
     
    Last edited: Oct 30, 2015
  48. sschaem

    sschaem

    Joined:
    Feb 14, 2014
    Posts:
    148
    What you see is not an effect of subpixel rendering/positioning but pixel snapping of the coordinate.

    The font also seem to have been generated using hinting, because both font look different.
    The bottom seem to be very square in design (help when doing pixel size font), the top has more curves and details.
    ex: Look at the top of the 'm', the bottom version is flat.

    Hinting is a design alteration of the font to change its structure to align with a 1:1 pixel grid.
    The designer will actually change the vertical & horizontal segment position and thickness for a given target PPI.
    This is normally done by the font designer and embedded in the TTF file.
    "Hinted smooth" will try to create the font asset using this data, if present.

    This example is also an extreme case because the 'e' is actually 5 pixel tall. This mean the thickness of the feature need to be 1 pixel and the spacing 1 pixel to look sharp. If its not, it wont be crisp...
    So you can create a modified version of some font for a 5pt size, but this cant be done with all fonts.

    Now, one thing that matter greatly is using linear color space. If you render using compressed value (gamma compressed) the anti aliasing can look muddy.

    Another detail is that if you scale down a font where lets say the T become less then 1 pixel thick, it wont look good anymore. You can look at this in reserve. Take any very small point size font, and scale them up to see the thickness of the characters feature. They are all very thick, and look almost like the bold version of the original.
    So dilate can help with using font with thin features at very small sizes.

    BTW, you can implement pixel snapping for the SDF. Look at the vertex shader for the bitmap font.
    This shader performs on the fly pixel perfect coordinate correction.
    So you can apply the vertical snapping to the SDF shader and see if this help with super small Pt sizes.

    other note: hinted smooth bitmap are not designed to be scaled, but instead should be rendered 1:1
    This will be pretty much as good as text can be, but it only support one PPI configuration.

    To recap:

    a) make sure linear color space is used
    b) use dilate if the feature of the font fall below 1 pixel in thickness
    c) try to use the pixel snapping feature (vertically) to get sharper/ more consistent looking tiny Pt size SDF font

    For c) , you will loose the ability to scroll your text box using sub pixel positioning.

    During my testing, this was my torture test.
    curve small.png

    To render this correctly you need to have perfect sub-pixel positioning of each character.
    The only issue that cant be solved is hinting, but in this example no hinted is possible by design because hinting only work for straight features.

    Anyways, try the pixel snapping, this should greatly improve the SDF version for your font .

    Another comment: never use SDF16 unless you are in a hurry. SDF32 might not make a huge difference, but it will extract more accurate feature for a character.

    Also try to use the small padding possible, and the smallest pt size (when creating an SDF font)
    to maximize the accuracy of the font data.

    ex: For UI font that dont use borders or single pass soft shadows, a padding of 0 is fine.
    And if you use the SDF only for super tiny UI font, create it as close as the minium size you will use the font. You gain nothing in creating a 30pt SDF font, if you only use it at 15pt.
     
    Last edited: Oct 30, 2015
    fherbst likes this.
  49. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    As Stephan already mentioned, I just wanted to further emphasize the use of Linear Color Space. This might affect your workflow a bit but since Unity wants all of us to migrate to a Linear Color Space workflow and it does result in better looking text, I strongly recommend it.
     
  50. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I am using linear color space and SDF 32 in the example I posted.

    I appreciate the in-depth reply. The reason for this extreme case is that since I'm designing at 4K resolution and using canvas scaling, the smallest font size I can use for body text at 4K is 30pts because when the canvas is scaled down to 1024x768, the text will have the size in the picture I posted above. At the average HD (1920x1080) resolution, the smallest text I can use is actually not that small, due to the limitation of text clarity at the lowest resolution of around 1024x768 when the text is scaled.

    I could use a non scaling canvas with non-scaling text, but then I'm losing a certain amount of resolution independence that I would get with say using Noesis or some other UI framework.

    Granted there are not many people using 1024x768 according to the Steam Hardware Survey, but there are currently 4 times the users at that resolution than there are at 4K. Supporting such a wide variety of resolutions for standalone is becoming a headache.

    You are right that in the second pic, the font shape gets altered due to pixel snapping in comparison to the TMPro version.

    I tried changing padding, and the lowest I could get was 3 without artifacts.This combined with lowering the font size in the asset creator to 30 (at 4K) made a slight improvement. Actually, with this font, Exo2.0, increasing the font size to 60 made it look a little better when used at small text sizes (1024x768), so thanks for the tips.

    I'd like to try the pixel snapping for the SDF, but I currently don't have the shader programming knowledge to figure out what to extract from the Bitmap shader and where to apply it to the SDF shader.

    I did try just using applying the bitmap shader to the SDF text, and I can see how it snaps, but obviously that's not going to represent how it will look with pixel snapping in the SDF shader. I hate to ask someone to do extra work, but is there a version of the SDF shader with pixel snapping I could try? Thanks.
     
Thread Status:
Not open for further replies.