S
S
SkyDreamer2014-02-22 17:59:23
Programming
SkyDreamer, 2014-02-22 17:59:23

Font rendering in the game: how?

I'll start with the fact that I'm making my own multiplayer game, with an idea, preference and noble ladies. And I got stuck on rendering fonts... I found two options on the Internet - a vector font and a pre-prepared font. But they have disadvantages:
The first variant - although the font is scaled, there may be a bunch of fonts, but ... It's hard, a big load on the video memory. And more weighty - such a font can only be displayed in the interface, which is not acceptable for me.
The second option is that it can't be scaled, all the characters I want to render must be pre-rendered to a texture, and I need to provide as many languages ​​as possible.
But while searching, I found a mention of alfa-testing technology, apparently from Valve.
Can someone tell me about her?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RPG, 2014-02-22
@SkyDreamer

The first option is basically not practical. I haven't seen a real project that would do that.
The alpha-testing technology has the more popular name Signed Distance Field (SDF). But for high-quality rendering of a font with anti-aliasing, shaders are needed (which in most cases is no longer a problem even on smartphones). This is a really good technology that allows you to render fonts of any size, with only one bitmap texture prepared in a special way.
If you need the support of alllanguages ​​- the best solution would still be to render on-the-fly into a texture from a TTF vector font with dynamic character packing as needed (freetype-gl library can do this). Of course, it is possible to generate a powerful texture in advance, but not all users will like it, and inadvertently you can miss some characters...
Related links:
What is SDF - an open topic on gamedev - www.gamedev.ru/code/forum/? id=175763
OpenSource raster font generation program including Distance Field (it's mine, but don't take it as advertising :) - https://github.com/scriptum/UBFG/
TTF rendering library in OpenGL - https://code.google. com/p/freetype-gl/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question