Forum

SDF Text Research

out if interest i tried creating a sdf letter based on valve’s idea, its kinda common in game engines for large text rendering. eg. https://github.com/libgdx/libgdx/wiki/Distance-field-fonts

i tried following the instruction, create a distance tex based on a hi-res image of the letter/word, scaled it down to something like 64x64px and render this with a drawSDF shader. the distance tex looks smooth but the drawSDF has nasty edges. So i’m missing something here.

Anyone interested and has done it before ? I think it’s kinda cool technique. SDFglyph.v4p (15.8 KB)
(u need Fieldtrip, DX11)

sdftext.zip (3.4 KB)

not perfect but kinda working

1 Like

also worth noting:
https://doc.xenko.com/latest/en/manual/graphics/sprite-fonts.html#signed-distance-field-sprite-fonts

you could use Xenko to generate the font texture and port their shader code:

@tonfilm

my second post has already an adopted shader in it. concerning the distance texture generation, the vvvv node is fine for one letter but having a fully working system, it needs some atlas technique…which is another task. i‘ll look into xenkos solution, for sure. looks more sophisticated.