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 - Advanced Text Rendering for Unity - Beta now available in Asset Store

Discussion in 'Works In Progress - Archive' started by Stephan-B, Feb 11, 2014.

Thread Status:
Not open for further replies.
  1. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Very very impressive ...
     
  2. sschaem

    sschaem

    Joined:
    Feb 14, 2014
    Posts:
    148
    Last edited: Feb 22, 2014
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    We'll need at least 30% of available characters from Japanese and much more from Korean. What we most likely will end up doing is writing a utility to scan what characters are actually used so we can come up with a subset. I can't say how many will be used right now as the translations come in at the end of development. I can guess at it with google translate but thats not going to be very accurate. So what we do is we get the translations back, then extract the used characters and make sure that they're only extracted once, without duplicates. That cuts down a lot. Our game is being translated to 15 languages per Sony's recommendation.

    I think max texture size we'd be comfortable with is 2048x2048, as SDF will ensure quality remains intact (doesn't need to be too large on screen). There's always the option to embed different data into different RGB channels, which gives us 4 textures in 1, a nice to have - although not much point if we can't pack them / prep them for SDF.

    It's not essential for us to embed 4 textures in one just yet - have to see what kind of character counts we're looking and and quality/size :)

    But yeah I think we might be a worst case scenario.
     
    Last edited: Feb 22, 2014
  4. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I was pleasantly surprised last night when I simply cut paste the result of Google translate into the Font Atlas Creator using the (Custom Characters) option which is essentially a list the characters to render. I was then able to cut and paste this text in the Input Text Box to get the following results.

    These 3 lines are suppose to say Game Over, Blue team wins, Red team loses but who knows what Google Translate gave me :)

    $Raw ScreenShot.PNG

    I think in the end, unless the characters needed are found within a certain number of ranges of characters, allowing users to provide a list of the characters to be generated might be the best option.
     
  5. bibbinator

    bibbinator

    Joined:
    Nov 20, 2009
    Posts:
    507
    This tool is brilliant! Nice work.
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yes, yes it is. The only annoying part is the author does not work 25 hours a day.
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    For a little while, I had been thinking about how to give user access to more sophistication text layout options but wasn't sure about including it in the initial release. So last night I decided to go ahead and create this first implementation. This is what I am currently thinking...

    $TextMesh Pro - Text on Curve.PNG
    Example showing translation and rotation per character. Unity Signed Distance Field text rendering.

    More sophisticated layout options will be accessible by adding a TMPro Advanced Layout component to any object that already has a TextMeshPro component attached to them. When such new component is attached and enabled, TextMeshPro will still create the initial text object but relinquish layout and uploading of the mesh data to this new component.

    This initial implementation uses the AnimationCurve class to define curves but I am having some issues with it right now. I am also considering allowing users to pick between some predefined functions or creating their own curve. Right now translation, rotation and scale per character can be done.


    $TextMeshPro - Text On Curve 2.PNG
    Example showing translation, rotation and scaling per character. Unity Signed Distance Field text rendering.

    Stay tune for more updates ...
     
    Last edited: Feb 23, 2014
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Not working 25 hours per day yet but I think we're slowly getting there :D

    Don't be mad but tomorrow I am going skiing with my son. So no updates from me until later tomorrow. However, SSchaem might be posting :)
     
    Last edited: Feb 23, 2014
  9. dstew

    dstew

    Joined:
    Aug 4, 2012
    Posts:
    35
    A couple of points:
    - In the second spline example pic, the blue outline in word 'text' seems to stay the same size as the bigger words. The word 'text' seems to be a bit blurry. This might be an artefact of the screen shot.

    - Are there any problems with using this with Unity's animation tools?


    This looks great. I'd love to see this kind of thing built into Unity.
     
  10. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    521
    Honestly: This will be an instant buy for many many people. I get decent effects done with NGUI labels but this is vastly superior. I hope speed on mobile will be good as well. Looking forward to a first release (and an introductory price ;-) ) very much. If you need beta testers count me in.
     
  11. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Instabuy
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is it possible to pool the quads used by this system so we can avoid submitting a new mesh entirely, ie max chars 32 for this text - would probably save performance on devices which don't like rebuilding meshes often.
     
  13. zipper

    zipper

    Joined:
    Jun 12, 2011
    Posts:
    89
    Holy Shnike!

    Text on a curve is already in - nice!

    Without being able to play with it (hint, hint), i would suggest text on bezier curve with bezier handles that could be edited in scene view..

    Did i mention i would pay to be a beta tester :)

    zipper
     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    If you open the image in a separate tab, you'll be able to take a closer look at the text. You will notice the blue border is actually smaller as expected.

    With regards to blurriness, you actually might be able to notice the word "text" isn't blurry but actually ever so slightly sharper. As a result of your feedback, I did discover that I had forgotten to update the scaling information on characters whose scale is changed by this new component. I have now made the correction so thank you :)

    Unity's Animation Component works well with some things and not so well with others. For instance, it detects when you change properties on TextMeshPro (which you can animate with it) but it fails to detect changes to the custom material editor. I also have another issue with how Unity's Animation Component magically changes public properties while bypassing the accessors on them. I am hoping that I won't have to restore to manually checking for changes to each of those properties each frame.


    Thank you.
     
  15. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    This is old and was for something else but I was planning on re-cycling parts of it. I never made a video of an updated version where the handles only become visible when the points are selected. But all this to say ... yeah bezier :)

     
  16. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I am not certain I understand your question / suggestion. Could you please elaborate?

    The part about limiting the size of the mesh to only hold a certain number of chars, I get. It's the "pool the quads" in conjunction with that subsequent part I am not sure about.
     
    Last edited: Feb 24, 2014
  17. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Oh - it's been a while since I've meshed about with it :) If I recall there's a problem if you clear the mesh as opposed to just submitting .vertices again etc - ie if it's changed size, it will probably cause a spot of our old friend the garbage collector - you'll have to potter about and see.

    Any ETA on this? surely you must be wanting that all-singing and dancing text on the latest games machines :O
     
  18. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    A lot of time was spent optimizing TextMesh Pro to make sure it lives up to expectations and performs as well as I could make it perform. It is a balancing act between memory / pre-allocations, GC hits and performance. The larger the mesh structure the longer it takes to upload. So keeping that mesh as small as possible while avoiding new allocations is key.

    Optimizations go beyond limiting the size of the mesh. The mesh structure (triangles) are only uploaded once. From this point on and unless the mesh changes, only the vertices and relevant vertex attributes are re-uploaded. Any unused vertices are marked as degenerates. Color32 is used for vertex colors since Color is so much slower. Even mesh bounds is manually calculated to maximize performance.

    I am sure further optimizations could be made and if I find / learn of new ones, you can rest assured I'll make them.

    Working on it. I must resist the temptation to add more stuff. For instance I had considered making the characters dance or sing but never both at the same time. :)
     
  19. zipper

    zipper

    Joined:
    Jun 12, 2011
    Posts:
    89
  20. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Great stuff! I think the spline thing is fairly pointless (sorry for being critical) as I mean - what game ever uses splines for text? None since the Amiga that I can recall! But just eager to input payment details, really. Please leave fluff till updates, it'll give you a reason to generate more buzz! (Yes I am 100% selfish and just want to throw my credit card at it).
     
  21. bibbinator

    bibbinator

    Joined:
    Nov 20, 2009
    Posts:
    507
    Minimal Viable Product in this case is already good. Release it, let people give you money, see where it goes :)
     
  22. zipper

    zipper

    Joined:
    Jun 12, 2011
    Posts:
    89
    Don't listen to hippocoder, one man's pointless is another man's project requirement :)
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    All very true! (splines are slowing me down from seeing glorious universes of text)
     
  24. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Just an FYI for Hippo ... I added the ability to provide the Font Atlas Creator a text file that contains the characters to add to the Font Atlas.

    Back to work I go ...
     
  25. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Awesome x 1000000000!
     
  26. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Just minor update.

    User Manual
    This week I worked mostly on the User Manual. I have to admit, I would much rather go to the dentist than writing a user manual. Would be so much easier to just make videos to explain all of this stuff :)

    Advance Layout Component
    Made some good progress on the Advanced Layout Component for which I should have an update in a few days.

    Font Atlas Creator
    Added a check to make sure duplicate characters are not added to the atlas when a list of characters is supplied from file.
     
  27. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The written manual is godlike for so many people.

    - Some people are hard of hearing
    - English isn't always a first language - but frequently can read English
    - Scrubbing back and forth through a video to find what you want is exhausting at best
    - It's more added value - look ma! I've got a REAL BOOK WITH WORDS
     
  28. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I concur. That's why I am writing one but I tell you, a visit to the dentist still feels more enjoyable to this and I do hate the dentist :)
     
  29. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    <snip> my dentist horror story is best not shared. Instead, please launch TextMesh pro :D
     
    Last edited: Mar 2, 2014
  30. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    This looks really amazing. Seems like a must-have. My wallet is ready. ;)
     
  31. SmashedAvocado

    SmashedAvocado

    Joined:
    Dec 19, 2013
    Posts:
    45
    This looks great! I've been looking for a TextMesh alternative for the past couple of days. I'll definitely buy this once it's available.
     
  32. Hermith

    Hermith

    Joined:
    Mar 4, 2014
    Posts:
    2
    Any ETA on the release? We're currently working on a bachelors project and this just looks amazing, and will save us a lot of time since we have a buttloads of 3DText formatting to do.

    The functionality we need the most is basic text formatting like line breaking and styling, and based on your videos you seem to have covered that part pretty much 100%.

    Great work.
     
  33. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    an ETA would be lovely.
     
  34. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I would guess a few weeks as I need to get TextMesh Pro in the hands of a few beta testers. Although some folks have released their assets in the store as beta, I am not sure about that. Maybe I am wrong...

    My biggest hurdle right now is the Mac which I need to (1) built / test the Native Plugin used by the Font Atlas Creator and then for the obvious iOS testing. I was planning on getting a Mac Mini whenever Apple gets around to updating it but they are taking their sweet time. However, I am running out of time...
     
  35. broken

    broken

    Joined:
    Mar 14, 2013
    Posts:
    30
    Hi! Accidentally saw this topic.

    Very cool, want to try it :)
     
  36. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    Wow, this looks super relevant to my interests and I will be keeping an eye out for it. Nice stuff!
     
  37. Hermith

    Hermith

    Joined:
    Mar 4, 2014
    Posts:
    2
    Can't you release it on the asset store and list compabilities with what you know works, and list iOS/Mac support as a future release? That way you'll get it distributed quickly, without releasing a not working product.

    We for example, only need it for desktop at the moment.
     
  38. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    By Desktop do you mean Windows or Mac?

    I need access to that Mac to built the Native Plugin (.bundle) for the Mac otherwise the Font Atlas Creator won't create much. I don't expect any issues but then again Murphy's Law is always in full force.
     
  39. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I have a Mac ... and several iOS devices ;-)
     
  40. broken

    broken

    Joined:
    Mar 14, 2013
    Posts:
    30
    It is possible to buy your plugin right now (with paypal for example)?
     
  41. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I have lots of iOS devices.

    It is just funny that after all these years, I finally get around to having a reason to buy a Mac and Apple just happens to decide to skip on updating the one I am looking for...


    P.S. I should be able to finally get my hands on a Mac this week anyway :)
     
  42. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I wish I could but it is not ready yet. However it will be soon. Soon it will :)
     
  43. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Up close with some Letters ...



    This image above is using plain old Arial SDF Font with a texture applied to the face and border along with bevel. This is using the Distance Field Surface Shader with a Directional Light to get some shadows and a few lights to add color. I also applied a Normal Map on this text object set to only affect the border.

    Below you can take a peak at the Distance Field Surface Shader settings.
    $Raw ScreenShot.PNG


    I could not resist :) So here is another image using basically the same settings but with the Normal Map affecting the Face instead of the Border. Looks like some cool cast iron.

    $Raw ScreenShot.PNG


    Now with just a spot light. As you can tell from the image above vs. the one below, scene lighting does make a big difference on the look of the text.

    $Raw ScreenShot.PNG
     
    Last edited: Mar 7, 2014
  44. broken

    broken

    Joined:
    Mar 14, 2013
    Posts:
    30
    Enough to tease us :)
     
  45. tufao

    tufao

    Joined:
    Mar 6, 2013
    Posts:
    3
    I'm new to Unity and I have been trying to get text to look decent and I came to the conclusion that is no easy task.
    For sure I'm very impressed with what you achieved.
    I'm curious how your component could handle the following features:
    - Dynamic text with text being filled in run-time (I guess this is no problem)
    - Dynamic text with font name being specified in run-time (generating the SDF font from a ttf file for example)
    - Handling arabic text - I'm not an expert but I have been working with Arab countries, the problem here is that characters are not just individual drawings per se they change when put together with other characters.
    It would be great to have your thoughts on that.

    Once again, great job and I will be looking forward to get my hands on Text Mesh Pro (at a nice price of corse ;).
     
  46. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    By filled you mean changed at runtime? If so, not a problem.

    Not a problem.

    Code (csharp):
    1.  
    2. // Example of how a specific font type and even material can be selected at runtime.
    3. textMeshPro.fontAsset = Resources.Load("Fonts/IMPACT SDF", typeof(TextMeshProFont)) as TextMeshProFont;
    4. textMeshPro.fontSharedMaterial = Resources.Load("Fonts/IMPACT SDF Plastic Bevel", typeof(Material)) as Material;
    5.  
    I had made a video a while back showing this but I guess I never uploaded it... so here it is at last.




    Using the included Font Atlas Creator, you can raster any characters but for certain languages where layout isn't from left to right or might require special treatment, I'll need to look into it.[/quote]

    Thanks :)
     
  47. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    While working on polishing the layout of the Custom Material Editors which involved re-testing all the properties of the Shaders, I ran into this minor issue with the layout of the text and I thought this might be an opportunity to showcase another feature of TextMesh Pro.

    So while going over the Surface Shader and tweaking various properties, I noticed that some of the letters were kind of overlapping. In part this is due (a) some of the letters in the Arial font being close to begin with like the 'r' and 't', (b) making the letter slightly bigger because of the outline and glow being added. The image below shows those issues.

    $TMPro - No Kerning.JPG
    Images shown without Kerning. Letter 'r' and 'f', 'c' and 'e' and 'x' and 't' are all too close to each other while 'T' and 'e' seem too far apart.


    To correct this minor character spacing issue, we simply add Kerning Pairs for the offending characters and enable kerning in the editor panel.

    $TMPro - Kerning.JPG
    Image shown with Kerning Enabled.


    And here is the Kerning Table part of the Font Asset. The Offset value for each kerning pairs is adjusted in real-time on screen.

    $TMPro - Kerning Panel.JPG


    Whenever you create a new Font Asset using our Font Atlas Creator, you can choose to import the kerning table for the font. Now if you elected not to do so, you can always manually add new kerning pairs as I did.
     
  48. SmashedAvocado

    SmashedAvocado

    Joined:
    Dec 19, 2013
    Posts:
    45
    Will the final version have the ability to "snap" the text so that it's as pixel perfect as it can be? I obviously don't know how your rendering works, but at some smaller sizes, text without snapping can make things look blurry. For example https://www.assetstore.unity3d.com/#/content/15320 does a good job of rendering text at appropriate sizes.
     
  49. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,630
    Looks super interesting. If you need beta testers I am more than willing, although I guess I would have to fight, at the very least, hippo and jashan for it first :p

    Can I ask for a favour? Can you show an example using some really thin font? (for example say this one: http://www.dafont.com/lane.font ). I haven't read how signed distance fields work exactly, but from my (minimal) understanding, it seems like it could be the type of algorithm that might mess up if the font is very thin.

    Also an ETA would be amazing :)
     
  50. sschaem

    sschaem

    Joined:
    Feb 14, 2014
    Posts:
    148
    My understanding, from the link you posted, there is some heavy CPU usage for scaling text, and the text will pop when in motion, or alternatively it will be 'blurry'.

    TMPro will give you those benefits without the associated limitations.
    You can check page 2 of this thread for some examples of sub pixel positioning and scaling.

    The text is always rendered from a high quality distance field, it doesn't gets blurry and its always sub pixel accurate, whatever the size.

    There is also no CPU overhead/ allocation of any kind when scaling text.
    So you get the predictable performance, and great quality even when you are moving/scaling at fractional values.

    note: TMPro also support hinted bitmap if you dont care about about dynamic sizing and sub pixel positions.
     
Thread Status:
Not open for further replies.