strange artifacts around characters
guichazan opened this issue · 2 comments
Hi,
Thank you for your library. I'm facing a problem when the font is reduced to size < 20 and have a weight > 0: there are some artifacts around some chars. I already tried several things on both shader and font generation but i was unable to fix it. Do you have any ideas of how to fix it?
This has a height=16 and weight=1.1
This is most likely due to insufficient padding between glyphs in the texture atlas. The artifacts you see are actually parts of other glyphs in the atlas.
Padding can be changed with -p
(glyph padding) and -b
(border padding) attributes in msdf-bmfont-xml. The default is 1 for glyph padding, 0 for border padding. I think 2 px for both works great but you can try higher values if you still get artifacts.
Also keep in mind that one limit of MSDF is the limited quality when rendered to smaller font sizes. Weight values far than 1 may also increase artifacts, but you can usually prevent that by having bigger glyphs in the atlas. Weight of 1.1 should be fine though.
Thanks, i was able to fix it in my branch of msdf-bmfont. I tried dozens of combinations before i found the one that really increased the size of the character texture.
https://github.com/guichazan/msdf-bmfont/blob/master/index.js