Branching off a new thread from an <@UEQ6M68H0> po...
# of-graphics
i
Have you seen http://sluglibrary.com ?
d
Yeah, it's a proprietary library that can't be used in open source or research projects. The algorithm is patented, so there's no point reading the paper and reproducing the algorithm in an open source project. Fortunately it isn't the only fast, scaleable GPU-based font rendering software.
e
Just because somebody has a library that renders text doesn’t mean it’s any good. For example Adobe buy a license to the Fujitsu font renderer That did some magical thing. Microsoft has taken decades to refine their renderer to get closer to Apple’s Quality which was ultimately licensed from Adobe. The reason stupid TeX still exists And is it own universe Yes because Knuth’s rendering engine doesn’t build upon true type, And anyone who tries to build a better math coding system gas to deal with rendering, Which is 100 times harder than devising a good notation. It is just a fact that GPU text rendering is pretty lousy Because the vast majority of 3-D games use prerendered font bitmaps, Probably generated On a Macintosh.
i
What do you think about HarfBuzz?
r
Reminds me of a great talk on how you can render scalable fonts on the gpu using distance fields

https://youtu.be/-O0-HEZAwg8

🍰 1
It still encodes the data within a bitmap which makes supporting the Chinese alphabet quite file heavy
d
There is also Glyphy. https://github.com/behdad/glyphy
GLyphy is a signed-distance-field (SDF) text renderer using OpenGL ES2 shading language.
The main difference between GLyphy and other SDF-based OpenGL renderers is that most other projects sample the SDF into a texture. This has all the usual problems that sampling has. Ie. it distorts the outline and is low quality.
GLyphy instead represents the SDF using actual vectors submitted to the GPU. This results in very high quality rendering, though at a much higher runtime cost.
Behdad Esfahbod is one of the authors of Harfbuzz. This project is about a decade old, and the performance is eclipsed by modern work, such as Raph Levien's Piet (research project) and Pathfinder (which is production quality).
My own research includes a resolution independent graphics model that is far more powerful than the 1980's "vector graphics" model descended from Interpress, Postscript, and SVG, that everybody still uses. If you represent graphics using signed distance fields, then you can have a much richer set of graphics primitives than SVG, and you can have a much richer set of graphical operators (non-affine transforms, binary operators like morph and blend). I don't have text support yet. I'm hoping to combine ideas from Glyphy, Pathfinder and Raph Levien's blog to create support fast gpu-accelerated text and 2D graphics within this much more powerful graphics model.
I want to build UIs using this SDF based graphics model.
r
@Doug Moen sounds super interesting. So this would basically allow vector graphics to run with much higher performance on the gpu?
d
Open source projects like Piet and Pathfinder are demonstrating how to render conventional SVG vector graphics (including fonts) with very high performance on a modern GPU. Raph Levien's blog goes into a lot of detail on this. Here is his latest post: https://raphlinus.github.io/rust/graphics/gpu/2020/06/13/fast-2d-rendering.html
What I want to do is generalize these results to support the much more powerful graphics model that I've implemented in my Curv project (at github.com/curv3d/curv). My code doesn't yet have the performance of these new systems. To get there, I need to use a modern GPU API instead of OpenGL 3.3 (because I need compute shaders). Which means abandoning older hardware. My current plan is to switch to WebGPU (which isn't fully baked yet).
g
Font rendering != text input https://lord.io/blog/2019/text-editing-hates-you-too/ Also I'd be surprised if the font rendering libraries mentioned above actually handle all the issues. https://gankra.github.io/blah/text-hates-you/ I'm 100% positive neither Unity nor Unreal handle these issues but then generally most games don't have much user based text except naming your character and players generally will put up with whatever limitations the game has.
👍 1
e
text input has a dependency on font rendering, because you’re drawing text. And having to interact with the directionality of the text you’re typing in, which in the case of Hebrew and Arabic might require you to switch directions in the middle of a single text entry field. And for Asian scripts like Korean Chinese and Japanese you type phonetically and then convert that into a selection of characters. With Chinese because of the large number of homonyms you type in "bai" And you get to see 15 different glyphs to choose from. Text entry is incredibly complicated, like I said this is why operating systems are valuable and important because the difficulty the seemingly simple text entry field presents is an almost unfathomably deep problem. It is the main reason why there are so few competing operating systems in the graphical interactive software world. If it weren't for text you would see 100 operating systems, and they would be lean and mean, not the sweathogs of today. I can remember when Win95 would run in 4 MB of RAM; now they recommend 1000 times the RAM to run Windows 10. The amount of bloat and excess in modern OS'es is rather embarrassing. There are billions of people using non Roman alphabet languages, and they present incredible challenges.
☝️ 3
j
@Edward de Jong / Beads Project Are you saying that text entry is representative of the sort of problems that bloat operating systems, or that text entry is the problem that bloats operating systems?
e
Text entry represents about 1 million lines of code if you include rendering. But that is not why operating systems are so bloated. The reason they’re bloated it’s because they don’t put small teams on operating systems do you have gigantic teams who use giant team approaches to making the operating systems. No small team can build a text entry field from scratch. The reason is that you have 20 different language input method editors, each requiring intimate knowledge of the human language. So you have a team for each one and you end up with 1000 people on the operating system team and guess what you’ll get: a giant bloated mess. If you look at my hero prof Wirth’s Lilith machine, You’ll see an operating system written from scratch in the Oberon language that a single person can understand the entirety of. It was graphical and did a lot of stuff. But he didn’t try to do Asian input methods because that would’ve been 10 times more than the code that the rest of the operating system took. And of course It got no traction because if you don’t do Asian languages you’re cutting out a good fraction of the entire human race. There have been some great operating system work from Nokia, Symbian wasn’t bad and they had evolved into something terrific, but they were destroyed by Microsoft Mole named Elop , Who infiltrated their organization and convince them to drop their very lean operating system in return for windows mobile which destroyed their company and caused them to completely collapse. Other than Adobe I don’t know any other company that knows enough about about human writing systems To build an actual competitive operating system that would suffice in today’s mobile world. I wouldn’t be surprised if Samsung is gradually building enough knowledge to do it, I don’t know the internals of Samsung but they are big enough to have enough engineers on staff to conquer this tough area where you need a team for each region you’re supporting. You can spend an entire lifetime and still not master Japanese text. Japanese is by far the most difficult language on earth to process. They use four different writing systems simultaneously: romaji, hiragana, katakana, and kanji, And to top it off family names in Japanese are not even in their character set and are therefore non-drawable, so people have to be able to add custom glyphs to their computers. No other language on earth has this problem. I made a lot of money in Japan because I knew how to work with their language it’s a fascinating subject that is immensely complex.