▲ | rudedogg 3 days ago | ||||||||||||||||||||||
Do you still want to do this for SDF font textures? Or is the lossiness an issue? | |||||||||||||||||||||||
▲ | exDM69 2 days ago | parent | next [-] | ||||||||||||||||||||||
Not for multi-channel SDF at least. Texture compression works terribly badly with "uncorrelated" RGB values as they work in chroma/luminance rather than RGB. For uncorrelated values like normal maps, there are texture compression formats specifically for that (RGTC). However, your typical MSDF font texture has three uncorrelated color channels and afaik there isn't a texture compression format with three uncorrelated channels. | |||||||||||||||||||||||
▲ | masonremaley 3 days ago | parent | prev | next [-] | ||||||||||||||||||||||
Good question. I don’t have any authored SDF content right now so take this with a grain of salt, but my thoughts are: 1. Fonts are a very small percent of most games’ storage and frame time, so there’s less motivation to compress them than other textures 2. Every pixel in a font is pretty intentional (unlike in, say, a brick texture) so I’d be hesitant to do anything lossy to it I suspect that a single channel SDF for something like a UI shape would compress decently, but you could also just store it at a lower resolution instead since it’s a SDF. For SDF fonts I’d probably put them through the same asset pipeline but turn off the compression. (Of course, if you try it out and find that in practice they look better compressed than downscaled, then you may as well go for it!) [EDIT] a slightly higher level answer—you probably wouldn’t compress them, but you’d probably still use this workflow to go from my_font.ttf -> my_font_sdf.ktx2 or such. | |||||||||||||||||||||||
| |||||||||||||||||||||||
▲ | TinkersW 3 days ago | parent | prev [-] | ||||||||||||||||||||||
A single channel SDF can be encoded to BC4 with fairly good quality, and it can actually represent a wider range of values than a u8 texture... but with the downside of only having 8 values per 4x4 block. So if the texture is small I'd use u8, for a very large texture BC4 isn't a bad idea. |