3 ms·
Higher Quality 2D Text Rendering (2013)
- metajack 8y agoIf you're interested in this, I recommended reading about Patrick Walton's work on Pathfinder: https://pcwalton.github.io/2017/02/14/pathfinder.html https://pcwalton.github.io/2017/02/14/pathfinder.html
- xiconfjs 8y agoit's missing the images :(
- xzn92 8y agoTry the wayback machine: https://web.archive.org/web/20170215003338/http://pcwalton.github.io/blog/2017/02/14/pathfinder/ https://web.archive.org/web/20170215003338/http://pcwalton.g...
- kjeetgill 8y agoA great thread on pathfinder with pcwalton all over it: https://news.ycombinator.com/item?id=13647146 https://news.ycombinator.com/item?id=13647146 > Pathfinder's rendering is best-in-class, equaling or exceeding the quality of the other renderers. FreeType, stb_truetype, font-rs, and Pathfinder all use exact trapezoidal area calculations for antialiasing. Most GPU algorithms use lower-quality multisample antialiasing, but matching the system renderer in quality is one of the key goals of Pathfinder. -- PCWalton
- ggambetta 8y agoBack when I was making games (and game engines), whenever I had to render text, I used freetype to render to a memory buffer, and uploaded that as a texture. Two triangles / one quad per "label". For this use case, where text labels don't change that often or are that many, the approach suggested in the article (two triangles / one quad per glyph, and having to do kerning by hand) sounds unnecessarily complex.
- jchw 8y agoDepends on lots of factors. I often used that approach too, but it has its downsides: uses a relatively large amount of texture memory, text can't be scaled, not really compatible with subpixel rendering¹. An example of another technique would be signed distance fields, which is useful for putting vector shapes like fonts into 3D environments without using high resolution textures. It has the property that you can transform the result fairly effectively, avoiding artifacts from antialiasing and pixelation. 1. Though it's pretty hard to avoid that since you really need to be able to do the alpha blending yourself.
- planteen 8y agoWere you still rendering individual glyphs into a font cache and then rendering those textures into a single text texture? It seems like it would be pretty expensive to always render each individual glyph from the font engine every time instead of caching the results.
- ggambetta 8y agoNo, just rendering the string every time it changed. For the kind of games I was making, text didn't change that often, so caching it worked fine.
- kuwze 8y agoThere is also the Slug library[0] for anyone interested. It is based on this paper[1]. [0]: http://sluglibrary.com/ http://sluglibrary.com/ [1]: http://jcgt.org/published/0006/02/02/ http://jcgt.org/published/0006/02/02/
- nofunsir 8y ago"This document is trying to connect to: http://jcgt.org" http://jcgt.org" Come on, guys.
- kevin_thibedeau 8y agoSeems like FreeType auto hinting is broken if it shifts the right vertical stroke over by one column for no clear reason. The inner portion of the loop has less then 50% coverage.