3 ms·
fonts being defined as a set of bezier curves you'd have thought it would quite easy to write a shader where each fragment computes its distance from the curve
by sguwwochqbib 8y ago
fonts being defined as a set of bezier curves you'd have thought it would quite easy to write a shader where each fragment computes its distance from the curve & assigns smoothsteped color as a function of that distance
- lostmsu 8y agoPerhaps Pathfinder mentioned above is implementing exactly that, but I am not familiar.
- jayd16 8y agoThis is kind of expensive actually. Its usually done with a precalculated texture sheet of glyphs which trades memory for shader perf. See: Signed Distance Field
- sguwwochqbib 8y agook but a precomputed texture isn't scalable
- jayd16 8y agoWhen its an SDF texture it is scalable because the distance function produces continuous data. The aliasing is greatly reduces because data is easily calculable from neighboring pixel samples. Edit: Here's Valve's Siggraph paper on the technique https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007...