Search Unity

FlyingText3D - Real dynamic 3D text from TrueType fonts

Discussion in 'Assets and Asset Store' started by Eric5h5, Jun 11, 2012.

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Update: version 2.2.1 out now!

    If you've ever wanted real 3D text in Unity, now's your chance...create text instantly from TrueType fonts, either dynamically at runtime or as prefabs. Works with Unity free and Pro, any language, should work on any platform. Comes as a .dll, plus source code is included. Get it on my website here! Also available on the Unity Asset Store!

    Text can be created as a single object, or as separate GameObjects for each character. No tediously importing static text models from 3D apps; instead it's as easy as this:

    Code (csharp):
    1. var text3D = FlyingText.GetObject ("Hello!");
    Or you can use the inspector utility to create text objects directly in the scene. You get lots of control over appearance, such as resolution, color, size, extrusion depth, spacing, and so on. You can use HTML-like tags to change fonts, size, etc. in a single line of text, or set up defaults in the inspector. For example:



    That was made with this text:

    Code (csharp):
    1. <font=Airstream><color=#5a7ae3><depth=.01><size=3>Flying<br><color=#e0e0e0>
    2. <depth=.2><font=Arial Black><size=1.5><space=.2>Text<depth=.75><zpos=-.25>3D
    You can use any material, and textures can be per-letter, or stretched over the entire text. The resulting GameObject can be animated and otherwise manipulated like any other GameObject.



    You can automatically add colliders and rigidbodies, which is especially effective for text as individual characters:



    It comes with a nifty custom inspector:



    (As you can see from that, you have to rename .ttf files as .bytes instead in order for them to work with FlyingText3D. You can do this outside of Unity, or use the inspector utility shown above. I wasn't able to find a way around that, since there's no access to the raw data of Font assets. If someone can think of a better work-around, let me know! Yeah, it's a minor thing, but I'd still rather avoid it if possible.)

    And, of course, it has complete documentation. While it's pretty capable already, it's just the 1.0 release, so there's more to come:

    • Add compound glyph support; currently simple glyphs work (which is what most characters are, but accented characters may or may not work, depending on the font).
    • Add better non-Western font support; pretty much it just does left-to-right at the moment. I'm not too familiar with this area, so if you have a font in mind that doesn't work right, it would be very helpful if you could send me a bit of text along with an illustration of how you would expect it to look.
    • Have the ability to set a smoothing angle for extruded edges, which right now are always hard-edged.
    • A utility for "baking" selected characters in the font, so the entire TrueType font file doesn't have to be included. A lot of fonts are quite small anyway, but this could be especially useful for Asian fonts, which tend to be >10MB. Also this would allow you to include fonts where you don't have a license to distribute the actual font, since it couldn't be reconstructed, though you'd still be able to change size, etc. (but the mesh resolution would be fixed).
    • Beveling, in addition to extrusion.
    • Possibly additional kerning and character mapping tables, if you find any fonts that aren't supported (though some fonts don't have any kerning info at all anyway).
    • Maybe some additional HTML-like tags?
    • Other stuff you think of that would be cool.

    Happy 3D-texting!

    --Eric
     
  2. JeffAU

    JeffAU

    Joined:
    Mar 22, 2009
    Posts:
    387
    Un-Bloody-Believable!!!

    Eric, this is awesome!!!

    This is the missing ingredient for killer title screens. I didn't realise how much I have needed this, until I saw it :)

    THANKS!!!

    (buying now)
     
  3. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    WOW !!!!
    Questions:
    * Not available at $5 (for me only ?) on your website ???
    * $5 too on asset store ??? It would be great !!!

    6R
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Thank you. :)

    It's $5 off the regular price. Sometime later it will go up to $25. I can't sell it for $5, it took a lot of development and does a lot of pretty cool stuff if I do say so myself. ;)

    --Eric
     
  5. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Impressive! For sure a buy!
     
  6. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    Just bought it :)
    Thanks Eric.

    -Ippokratis
     
  7. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Oooops... Sorry !
    I understand this and was so surprised about this low price !!! :)
    For sure it's a great plugin, even for $20 !!! ;)

    Will it be for $20 too on the asset store for a limited time ??? Because it's a tool to quickly import in each project !!!

    6R
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It'll be $5 off on the asset store for a limited time, yes, although the price is a little higher there (because I have two prices on my website, which can be voluntarily chosen...this has worked very well but there's no way to do that on the asset store). I submitted it yesterday, so it should be up in the near future.

    --Eric
     
  9. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    *Thumbs up*

    This was a day one purchase for me. Great job!
     
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    It's on the store!

    Maybe some text outline effects would be cool :)

    Is it possible to have the text scale and relative position with different resolutions and aspect ratios? for iPad iPhone desktop etc?
     
    Last edited: Jun 13, 2012
  11. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    €23.75 on the asset store instead of €16.44 on your website !!!
    I had to buy it from your website...
    For €7 difference I can accept some manipulations.

    6R
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, that would actually be very similar to the bevel effect I have in mind.

    It's a 3D object, so it already scales to different resolutions automatically.

    Yes, as I mentioned earlier, the price on the asset store is sort of in between the two prices on my website.

    --Eric
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    FlyingText3D 1.1 is out now (update notices sent to buyers from my site, will upload to the asset store next)...it adds support for compound glyphs, so you'll find that characters with accent marks work.



    It's not implemented 100%, since there are some things like matrix scaling/rotation it can do, but I wasn't able to find any fonts that actually used this feature. Since I don't want to include untested stuff, I left it out for now. So if you find any characters that don't look right, let me know, thanks!

    --Eric
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    And it's on the asset store! (They seem to be pretty fast with approvals lately.)

    --Eric
     
  15. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    187
    Just got this, and I am not even sure if I am going to use it, but I wanted to purchase something from Eric5h5 as gratuity for solving some of my Unity related problems on Unity Answers and this forum. They guy makes a huge effort on Unity, and I appreciate that.
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Thank you; I do hope you use it though. :) Just implemented left/right/center justification for the next version:



    --Eric
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    FlyingText3D 1.2 is out now:

    Additions:
    • Smoothing angle for making extruded edges have smooth lighting. It works the same way that the smoothing angle for imported meshes works in Unity.
    • Left, right, and center justification for lines of text.
    • A "justify" tag, so that different lines can have different justifications.
    Improvements:
    • Warnings printed for unrecognized tags (helpful for catching typos).

    Having smoothed edges reduces the number of vertices as well as looking better...the character below is 396 verts with a smoothing angle of 0, and 272 verts with a smoothing angle of 50.



    Will be uploading the update to the asset store next.

    --Eric
     
  18. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    I like the font in this picture :)
    Some crazy ideas :
    1. Beveled edges. Adjustable % of bevel.
    2. Animated effects ( a-la Final Cut ).
    3. Particle effects.
    4. A new implementation of the "Make me rich now" button.

    I find this asset great, thanks for it.

    -Ippokratis
     
  19. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    Eric, this slipped under my radar... well... fantastic, as ever!

    Best regards,
    Matt.
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm not surprised. ;)

    Yep, that's coming.

    Can you explain more?

    I had to scrap that, because while it mostly worked, approximately every 10th time you click it, an anvil inexplicably falls out of the sky and crushes you. And I refuse to work on that bug anymore.

    Thanks!

    --Eric
     
  21. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    FlyingText3D 1.2 is out on the asset store now...it would be cool if some who bought it would leave ratings/reviews. :)

    --Eric
     
  22. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    Would it be possible to have this in c#? Would be happy to pay the $40 price for it ;-)
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's already in C#.

    --Eric
     
  24. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    Awesome!
    Also can the code be scripted dynamically and not through a inspector?
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, that's the primary idea, though you can create objects in the inspector too if desired.

    --Eric
     
  26. paprocjo

    paprocjo

    Joined:
    May 16, 2012
    Posts:
    12
    Never Mind
     
    Last edited: Jul 11, 2012
  27. Grieva

    Grieva

    Joined:
    Jul 12, 2012
    Posts:
    4
    Does this work with dynamic fonts on iOS?
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It works with TrueType fonts. You can use pretty much any TTF that you include with your project, and it's similar to dynamic fonts in that it only computes characters that you actually use.

    --Eric
     
  29. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    Many of the examples (I'm assuming these are screenshots) seem to have some anti-aliasing on the text. My edges are very harsh, though, regardless of resolution. Would the beveling solve this? Here's what I'm going for:



    Kidding...but it would be neat-o!
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Did you turn on anti-aliasing? I did, which is why the examples have it. :) Beveling won't have any effect on that. You should be able to achieve that screenshot, actually, with a bit of manual positioning for the "Y".

    --Eric
     
  31. VFXM

    VFXM

    Joined:
    Jul 10, 2012
    Posts:
    4
    does it work with non-English fonts like Hebrew - Farsi - Arabic (Right-to-left) ?

    Regards.
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It doesn't currently do right-to-left, since I'm not familiar with those fonts and can't test it properly myself. If you could provide some info, that would help me implement it. How is this usually handled in code? Are strings entered "backwards"? If you could post a line of code where a string is declared in, say, Hebrew (I have ArialHB.ttf so I can test that in FlyingText3D easily), and an illustration of the expected result, I would appreciate it.

    --Eric
     
  33. VFXM

    VFXM

    Joined:
    Jul 10, 2012
    Posts:
    4
    I don't really have coding experience but yeah Farsi and Arabic strings entered backwards and some chars are linked together

    i'm using a free script for Adobe after effect that make it possible to enter Farsi and Arabic texts and it's written in JavaScript so it may be helpful for you

    here is the link

    http://aescripts.com/arabictext/

    "Add to cart - put the amount $0 -> checkout - download"

    Regards
     
  34. Dakwamine

    Dakwamine

    Joined:
    Aug 5, 2012
    Posts:
    21
    Hi all! (second attempt of replying)

    I was wondering if there is a way to use the system (OS) font instead of a font asset. If yes, is it possible to have fallback characters when the font doesn't contain a specific character?

    Also, sometimes when using the inspector creator, this editor no longer takes into account my settings in the Text settings panel. I have to restart Unity to get around this bug. I am on Unity 3.5.5f2.

    Anyway, thanks for making this great tool. I use it for my GUI text instead of GUIText or TextMesh. The antialiased rendering of text generated by FlyingText3D is much more convincing than the Unity TextMesh, mainly at tiny size on screen (< 10 pixel height).

    Thanks for your reply!
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It can only work with TrueType font assets, sorry.

    That sounds strange; I've never seen that before. Do you have any specific info on what's going on when this happens?

    Good to hear, thanks!

    --Eric
     
  36. Dakwamine

    Dakwamine

    Joined:
    Aug 5, 2012
    Posts:
    21
    Just tested a few times to find the origin. Here is my report: after deleting the GameObject which contained the editor and making an Undo, the inspector does not update values anymore. :p

    Yeah, I was a power tester in video games a few years ago. :cool:
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's definitely a useful skill. ;) Thanks, I can reproduce that here. Now to figure out what, if anything, I can do about that.... So far what works is removing/re-adding the component, so at least you don't have to restart Unity.

    --Eric
     
  38. Dakwamine

    Dakwamine

    Joined:
    Aug 5, 2012
    Posts:
    21
    Thanks for the tip.

    Also, I am trying to use a font. But I get some weird inaccuracies on curves. For example, I have to move a control point (via FontForge) 1 unit down for having the correct curve. Obviously, I cannot spend my time to modify each character. I hope you will find solutions to better parse or interpret the glyphs outlines.



    On this image, I moved B 1 unit from its original position in order to get the green "n" which is the good "n". The original TTF output is in red.
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    What font is it? The outline parsing is about as good as it can get, with the exception of not implementing font instructions, which are normally only used for bitmap hinting, which is irrelevant for vector outlines. I have found that occasionally font instructions seem to be "misused" to alter the outline, instead of simply supplying the correct outline to begin with. In my experience with dozens of fonts this is fairly rare, and since implementing font instructions is very complicated (it involves creating a virtual processor and instruction set interpreter), that would take me quite a long time to program, and therefore significantly increase the price. I figure having a low price and less code is a good tradeoff for occasionally having to fix a stray character.

    --Eric
     
  40. Dakwamine

    Dakwamine

    Joined:
    Aug 5, 2012
    Posts:
    21
    I am using a font named CPMono_v07 found on fontsquirrel.com. But I am not sure that the problem has to do with instructions. I will investigate from my side if I can find a solution about that.

    Update: It seems that the parser places curve points properly — corresponds with the real points of the font. I will check the algrorithm of the "interpolated" points.

    Update: I have strong suspicions that it may just be the off-curve / on-curve problem. on-curve points are treated as off-curve.

    Update: In the ReadGlyphData() function, even if I force allOnCurves values to true in the first while, some points of the glyph stays off-curve after... That's strange.
     
    Last edited: Aug 16, 2012
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That seems to be .otf rather than .ttf, so I can't test it.

    I'm quite sure that on-curve points are not treated as off-curve. If you have Vectrosity, you can uncomment the debug outline stuff in GlyphData.cs to see this clearly. The letter "a" in CourierNew, for example:



    Green is on-curve and red is off-curve.

    --Eric
     
  42. Dakwamine

    Dakwamine

    Joined:
    Aug 5, 2012
    Posts:
    21
    I don't have vectrosity, but I was able to figure out the curves and control points via dirty tools. XD

    Concerning FontSquirrel, you can download packs: for most of the fonts, you can download OTF, TTF, WOFF, SVG versions of the same font. And you have an online converter and almost all fonts have free licenses (SIL, Freeware, Authors license...).

    But, hey, I have very good news: I found a solution for the on-curves / off-curves problem! There was a little bug in the interpretation of the bytes near the REPEAT loop. Do you wish I post somewhere my corrections? (here or elsewhere?)

    Give me 1000 € and you will get the solution. No I was joking. :D Because I am so happy to have found that! Just tell me where I can paste my few lines.

    Bonus: Screenshot of Chancery corrected without override!



    PS: And if you mind giving me some free copies or a refund, I won't say no. :D
     
    Last edited: Aug 16, 2012
  43. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    I'm currently testing GetObject with iOS and it generates the characters fine in Unity but not on iPhone. Letters like A and D are missing on the iPhone. My code is pretty simple:

    // for example
    GameObject newText = FlyingText.GetObject("MAGIC WAND", null, 2.0F, .35F, 20, 1.0F, 1.0F);

    // would output
    M GIC W N

    I put A and D in override characters, too...no difference. I'm using Arial but would like to use any open source sans-serif font of medium weight. Any suggestions?
     
  44. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    Just realized there are errors in the xcode console for the missing characters (This is in Bebas Neue, missing chars BDOPQR), for instance:

    Does this mean these fonts cannot be used on iOS devices?
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Many thanks to Dakwamine for helping to find a bug. It turns out I was looking in completely the wrong place for why the occasional character didn't render correctly, so after fixing that, the override characters feature is no longer needed. So version 1.2.1 is now available and update notices have been sent to those who bought from my site. I'll be uploading to the Asset Store shortly.

    Indeed, I'm getting the same problem. It works correctly with other fonts, but not all of them. It's really strange. Obviously there's some difference between the way Unity is running this on the desktop vs. iOS devices (I guess I got lucky with my earlier iOS testing, since I didn't run across this before). I've tried things like changing stripping levels etc., as well as going over the code some more, but haven't solved it yet. Unfortunately version 1.2.1 doesn't help with this. I'll have to do some more intensive investigation, but in the meantime, you can try lowering the font resolution as well as trying different fonts.

    --Eric
     
  46. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    Eric, thanks! I've experimented with resolution a little and it seems to have no effect on the missing characters. I'm going to keep searching for fonts. If you can recommend a medium/heavy weight, fairly narrow sans-serif that you know works (I only need upper case, even) please let me know. At this point I've tried 6 fonts and all are missing at least 2 characters. 5 of the fonts render correctly in Unity. Just installed the 1.2.1 update and still no luck -- though all the curves are indeed working nicely!
     
    Last edited: Aug 22, 2012
  47. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    Sorry, just bumping this. Are there _any_ fonts known to render all characters on iOS without the "Triangulation failed for char code"? We've tried 10 fonts today and they are all missing characters when rendered on the device.

    Would it be a good idea to alert potential purchasers that this package is not iOS compatible?
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, I found the issue. Strangely, I think it might actually a bug in the desktop version of Unity, even though the result is that it works properly on the desktop and not on iOS. Ever heard of a helpful bug before? ;) Anyway, the workaround for the bug(?) is to change line 64 of Triangulate.cs from

    Code (csharp):
    1. Vector2 p2 = new Vector2(float.MaxValue, p1.y);
    to

    Code (csharp):
    1. Vector2 p2 = new Vector2(999999.0f, p1.y);
    I'll be making a 1.2.2 update with this fix soon. (Also that explains why my iOS testing worked with no problems previously, because that's what I had originally, and I only changed it to MaxValue later "just to be sure".)

    --Eric
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    1.2.2 is now available on the Asset Store, and update notices were sent to purchasers from my site yesterday.

    --Eric
     
  50. AlanParsons

    AlanParsons

    Joined:
    Jul 17, 2012
    Posts:
    18
    Eric, great! Thanks! Just tested on iOS and no more errors.