Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.9k stars 404 forks source link

SDF from glyph curves? #199

Closed jay3d closed 5 months ago

jay3d commented 5 months ago

I will start with this question: Does msdfgen use the glyph outlines directly? Or is it just using the rasterized output from FreeType?

image

Because the scaled output above suggests otherwise.

Since the curve subdivisions are not really customizable in FreeType (it's calculated based on the raster size), so I "guess" this is translated to the generator.

If this is the case, then I suggest using an SDF Bezier function (quadratic/cubic) to generate the SDF output from the glyph outlines directly.

https://www.shadertoy.com/view/7sKfR1

Chlumsky commented 5 months ago

Thanks for the tip. It uses curves directly, what you are seeing are the lines from the bilinear filtering of the SDF raster.

jay3d commented 5 months ago

image

I have solved it by using a custom bicubic texture lookup method :)