What does HackerNews think of msdfgen?

Multi-channel signed distance field generator

Language: C++

Super big fan of SDF text rendering and their ability to get effects like soft-shadows and hard bevels, essentially for free by baking Multi Channel and Single SDFs into one RGBA texture.[1] was surprised to see emojis work without being decomposed into separate parts, albeit the colors losing their sharpness above the texture's 1:1 resolution.

[1] https://github.com/Chlumsky/msdfgen

> KiCad uses a technique using RGB for gradients so that the rendered glyphs can be anti-aliased without accidentally rounding sharp corners.

This is known as a “multi-channel signed distance field”, or “msdf”.

https://github.com/Chlumsky/msdfgen

> It only works for moderate scaling up before looking bad

That problem has been solved by multi-channel signed distance fields https://github.com/Chlumsky/msdfgen

What I was referring is SDFs/MSDFs as in https://github.com/Chlumsky/msdfgen .

Of course you can implement smooth circles directly in a shader the way you describe, but note that there are Vector outline shapes that are not circles...

Check out the outlines you can do using SVG - paths composed of straight line segments as well as cubic bezier curves and various arcs. Also color gradients, stroking...

I wonder how signed distance fields performs in practice. Seems like it would fix, or at least minimize the scaling/offset issues quite nicely.

https://github.com/Chlumsky/msdfgen

Not sure if your game has any spatial 3D consideration but this project uses real time Multi-channel signed distance field generation :

[1] https://github.com/Chlumsky/msdfgen

You can always render the text to a texture offline as a signed distance field and just draw out quads as needed at render time. This will always be faster than drawing from the curves, and rendering from an SDF (especially multi-channel variants) scales surprisingly well if you choose the texture/glyph size well.

A little more info:

https://blog.mapbox.com/drawing-text-with-signed-distance-fi...

MIT-licensed open-source multi-channel glyph generation:

https://github.com/Chlumsky/msdfgen

The only remaining issue would be the kerning/layout, which is admittedly far from simple.

I do recall somewhat recently a great improvement was made to SDF using multiple channels of information: https://github.com/Chlumsky/msdfgen

I wonder how they both compare. I am guessing Slug is more accurate but certainly also much more intensive, if its actually rendering outlines.