From a quick web search, I didn’t find much info on any attempts to render BMFonts in Babylon.js. By BMFont I’m specifically referring to the AngelCode format of bitmap fonts, where you generate a texture atlas with font glyphs and some metadata with glyph uvs, kerning, etc, and then have some code for arranging a set of quads (based on glyph size and offset) with uvs mapped to the atlas and a simple shader that samples the atlas. This is a really common (and pretty old school) text rendering technique, and I’m hoping someone has already done this in Babylon.js. Can anyone point me to anything already existing for this?
@dennemark I was thinking the same thing… it seems like there are already a lot of support libraries that would make bitmap font rendering in Babylon.js pretty doable:
load-bmfont - can load the font metadata (glyph UVs/sizes in the texture atlas, kerning info, etc.) generated by the AngelCode BMFont tools.
Given those, it seems like all we would need is to actually generate the quads determined by layout-bmfont-text, and maybe a custom shader (maybe a standard shader would be ok, not sure).
I also found a tool for generating single channel and multi channel SDFs for fonts: msdf-bmfont. If we wanted to go further than regular bitmap fonts and support SDF/MSDF fonts, we could pair this tool with the libs mentioned above (the metadata is the same format, as are the texture atlases for SDF/MSDF), and a custom SDF shader. Seems like a simple SDF shader can give relatively good results, as described here: https://blog.mapbox.com/drawing-text-with-signed-distance-fields-in-mapbox-gl-b0933af6f817. I think MSDF shaders are harder, not sure.