Poor distant field font quality and rendering issues

So we’ve been struggling a lot lately with getting fonts in the 3D world to look decent or even work properly and there really isn’t any documentation for the Distance Field fonts and Text Renderers. The best help I’ve found so far has been another answerhub question here: How do I import and use custom fonts? - Platform & Builds - Unreal Engine Forums

So with that in mind (and well me being a producer so I could’ve just made some obvious mistakes) the first problem is that the base quality of the distance field font is pretty bad when trying to import other fonts:

As you can see, the quality compared to a non-distance field font on the right is really noticeable. You can see the import settings there and since there’s no documentation (though the settings do make sense I understood quite a bit of it) so I was following Xenome’s instructions and so far randomly tweaking the font size and distance field variables hasn’t resulted in any better results. Increasing the resolution from the default 256 to 512 helped to get at least some white pixels there (there were no true white pixels with the lower resolution). Of course one of the problems here is the rather detailed font, but at the same time some thinner fonts like Open Sans suffer from similar problems as well.

So ignoring the slightly questionable result (which at least should be somewhat improved with a different font and settings), the real problem is the the text material. Even the default engine content material font is not true white and with the “magic number” lerp the font is something that I have no clue what it’s supposed to be for other fonts and it’s half impossible to get it right for some fonts (-90,90 doesn’t work very well for some fonts like Xenophone and Open Sans). Here you can see a comparison of the font import preview and the actual font material:

As you can see the color is wrong (172, 184,186) and even if I replace the base color with a (1,1,1 const) the result is the same. There’s also some slight rounding happening (which is much worse if I try another font like Xenophone or Open Sans) which is really bad when trying to you use a thin and sharp font. Another problem is that it really doesn’t scale very well, there’s plenty of aliasing when it’s scaled down and since it’s used in the 3D rendered world FXAA then breaks it totally (which is another problem that I will come back to later on)

Next up is the outline implementation (taken from this question: Gradient color text and black border - UI - Unreal Engine Forums) and the actual quality and scaling in-engine. The outline would simply not work with Xenophone font because of the problems with Distance Field: Screenshot - a251389eafefe6b1c8005cde2c3864ea - Gyazo

With the standard roboto font and material and the outline, the actual result looks like this

For a commercial game the quality simply isn’t good enough and smaller card size and especially during the animations the text flickers like crazy. I’m quite stumped on how I could make it better and we are trying to go for an emergency option of making a separate material and spritesheets for the numbers and baking any text directly in to the texture, but it’s not a very good solution in the end as we would like all of it to be derived from the CSV and easily changeable. Here’s the result pulled directly from a play session:

(you can see the problem on the right with the open sans font and no border and the problem is tenfold in motion with tons of flickering)

As you can see the scaling is not working quite as it should according to the Valve paper: http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf

The final problem is that we haven’t found a solution to apply different AA for the text renderer as both TXAA and FXAA can’t handle text very well. Since it’s rendered on top of a 3D card (we couldn’t do that part of the UI with UMG, even though the rest of the UI is done with it) so the FXAA is then applied to the cards too. Is there an easy way to separate it from cards and actual 3D world where we really do need the AA?

I know it’s a difficult matter, but we could really use some help as we are preparing for the Nordic Game Conference in a couple of weeks where we will be showing the game to a few publishers, so any help would be deeply appreciated.

EDIT: Fixed some typos and added the FXAA problem

I’m having the exact same issue! Did you ever figure it out?

Hello,

Tatu Teittinen and KikyoPorter,

There a few things that factor into how crisp your can make your edges.

First will be the type of font that you use. Thinner fonts can be eaten by AA. This is most obvious in the 5 and the a on the card.

Second is the way that the alpha channel is drawn and calculated inside of your material. If you change the blend mode of your material to Translucent and then turn on Responsive AA under Translucency your edges will be much crisper.

The best method for eliminating issues like kerning and leading as well as to create edges that are not subject to how someone else made the font is to create your own. I suggest using Adobe Illustrator, as it is Vector based, and create your own custom font. Or if you find a font you like to adjust it there.

Typically letter sheets are limited to one sheet to eliminate scale issues.

If you download a font off of the internet you will always run the risk of having jagged edges that are part of the font itself. However, this method should eliminate the edges you are seeing that are produced by AA.

Thanks,

Hello Tatu Teittinen,

I haven’t heard from you in a few days.

Due to tracking issues I will be marking the answer I gave last as correct. This will close the thread.

If you are still having this issue, comment again and I will continue to work with you on this matter.

Thanks,