logoalt Hacker News

A Decade of Slug

716 pointsby mwkaufmayesterday at 6:59 PM71 commentsview on HN

https://web.archive.org/web/20260317185928/https://terathon....


Comments

miloignisyesterday at 7:37 PM

This is wonderful news, and my sincere thanks to the author. I remember coming upon this algorithm several years ago, and thinking it was extremely elegant and very appealing, but being disappointed by the patent status making it unusable for FOSS work. I really appreciate the author's choice to dedicate it to the public domain after a reasonable amount of time, and congratulations on the success it had while proprietary!

Now if I ever get around to writing that terminal emulator for fun, I'll be tempted to do it with this algorithm for the code's aesthetic appeal.

show 2 replies
astroalexyesterday at 10:13 PM

I used Slug at a previous job. It is an excellent, artfully crafted library; really the pinnacle of software engineering in my opinion. Thanks to the author for donating the algorithm to the public domain!

cachiusyesterday at 8:54 PM

His latest project is https://radicalpie.com/

A Professional Equation Editor for Windows 10/11 for 60$ that uses Slug for rendering. Presumably he‘s using it to write his great FGED books.

show 1 reply
Lichtsotoday at 10:03 AM

There are two ways to get winding numbers and then decide on filled or empty by some rule like non-zero or even-odd:

a) The winding number of a point is the number of intersections of a scanline and a closed path.

b) The winding number around a point is the total angle subtended by the path at that point.

Slug uses approach a) and that comes with a lot of edge cases (see chart in the post) and numerical precision issues. The approach by loop & blinn uses b) and is thus simpler and more robust. Likewise the patent on that one expired too: https://news.ycombinator.com/item?id=47416736#47420450

show 1 reply
amagitakayositoday at 1:03 AM

Amazing, Thank you Eric!!

Also, Microsoft's Loop-Blinn patent for cubic curves will expire on March 25. These might change the landscape of text rendering...

show 1 reply
tokyovigilantetoday at 3:43 AM

Thanks Eric, much appreciated. How would you compare your approach to something like Vello (https://github.com/linebender/vello)?

show 1 reply
byearthithatiusyesterday at 8:24 PM

Love it when someone who makes complex, helpful software is rewarded for their efforts. More stories like this!

Vipitisyesterday at 8:43 PM

I am sorta in a position where implementing a glyph renderer as a compute shader would be helpful. This is a great opportunity to use this as a reference... exciting weekend project!

Cthulhu_yesterday at 9:14 PM

Damn, I worked with the author's game engine (C4) about... 20 years ago now while still in school, didn't know they were still active in that area!

Benjamin_Dobelltoday at 11:30 AM

Thanks, Eric; for this, and for my start as a software engineer — my first commercial development work was consulting as an 18 year old building games with C4. I'm really glad Slug was able to find commercial success for you in the way that C4 unfortunately wasn't able to.

For those of you who aren't familiar with Eric's work, he's basically the Fabrice Bellard of computer graphics.

sbinneetoday at 7:19 AM

I am not at all familiar with game development. This article reminds me of Casey Muratori mentioning a font issue in game development environment from a random podcast. On web, you can just fetch a google font whatever. No problem. On a local machine, you tend to look a well-established software like harfbuzz. But then harfbuzz could be rather a big dependency. A game is self-contained and you want your font looks cool and unique to your game, like the Diablo font. So it becomes a design issue. It's an awesome approach to let GPU render fonts. I cannot imagine how many game devs had font issues where they realized that they might have to learn how to render fonts as well not just characters and grass.

show 2 replies
VikingCoderyesterday at 8:07 PM

Is it on ShaderToy yet? :D

weslleyskahtoday at 7:13 AM

So nice to see this here. The author's books are awesome resources for graphics and C++. It's a shame there seem to be fewer print editions available these days!?

andaitoday at 1:57 AM

This is super cool. A few years ago I was wondering if Ruffle could do something similar, incorporate some kind of GPU accelerated vector graphics.

At the time they were going with, approximating the curves out of triangles. I don't know if they're still doing that though.

ameliustoday at 9:19 AM

> I was granted a patent for the Slug algorithm in 2019, and I legally have exclusive rights to it until the year 2038. But I think that’s too long.

This is cool but I did not know software patents were still a thing in the US.

lacooljyesterday at 9:51 PM

> But I think that’s too long. The patent has already served its purpose well, and I believe that holding on to it any longer benefits nobody.

Damn dude didn't you pay like ... over $10k for that patent?

show 1 reply
Ono-Sendaitoday at 11:50 AM

So now the algorithm is patent-free, and the vertex and fragment shaders are open-sourced with the MIT license, what we presumably need is some open-source code to take Bezier curves from a font file (or from the loaded data from FreeType or whatever), and process them into the data format that Slug expects.

Also thank you to Eric Lengyel, I have had my eye on Slug for a while and wished it was open-source.

swiftcoderyesterday at 9:04 PM

Lengyel continues to be standup dude, kudos!

adamrezichyesterday at 10:41 PM

Finally, some good video game development news!

Validarktoday at 12:08 AM

Awesome algorithm and thank you for donating it to open source!

valentinomici51today at 8:12 AM

I've been following this project for a while. Nice to see the progress.

leecommamichaelyesterday at 9:51 PM

Thank you!

forrestthewoodsyesterday at 8:26 PM

Oh wow this is crazy. This was a project that was reasonably successful commercially. And now it’s just being given away open source? What an absolutely incredibly gift to the community!!

show 1 reply
maximilianburkeyesterday at 9:29 PM

Amazing! Thank you, Eric!

moralestapiayesterday at 7:53 PM

Thank you for your service!

rrauenzayesterday at 8:07 PM

Here's an alternate if you're also getting connection reset errors:

https://web.archive.org/web/20260317185928/https://terathon....

show 1 reply
myylogictoday at 12:41 AM

[dead]

Iamkkdasari74today at 12:29 AM

[flagged]

fasteriktoday at 12:22 AM

[flagged]

wei03288today at 1:47 AM

[flagged]

show 2 replies