We were looking into using the new slate distance field support to add some soft shadows to some text. While all the components to do so are technically present, there doesn’t appear to be a way to control how far the distance field is computed for (ex: to dilate it larger for softer shadows). Is there something I’m missing here or a modification we could make to expose the distance multiplier it uses? I have a feeling it would need the actual geometry to be expanded as well so perhaps such a modification wouldn’t be trivial.
Hello,
While you should be able to add soft shadows without any modifications, you might be limited by the spread of the distance field (and the size of the glyph slot in the texture) for softer/bigger shadows.
Currently, the only way to play with this spread is when configuring the size of the outline for a text (the bigger the outline, the bigger the spread and glyph slot size). But even if you hack that (using a non null outlines size with an alpha 0 outline), it wouldn’t be usable as it will also slightly move the glyphs position, the outline impacting the layout of the text.
The correct solution would be to expose a setting, likely on the font face, and ensure that it’s handled properly in FSlateFontCache::GetSdfGlyphFontAtlasData, when computing the EmOuterSpread.
Expanding the geometry based on this value is actually already handled, without visually moving glyphs position, so it wouldn’t require any extra work on that side.
Please note that increasing the spread of the distance field (and the size of the glyph slot in the texture), will necessarily require more space in the font texture atlas.
I can’t give you an ETA at this stage, but I think this “spread” setting is definitely something we should support in UE.
Yohann
Ok thanks. We’ll probably wait for official support on this since it’s not an urgent need on our end.