Archive 17/01/2023.

Is UIElement support Signed distance field text?

magic.lixin

I`m trying to use UI Text with font “Fonts/BlueHighway.sdf”, but it looks like this:

OvermindDL1

Your image appears broken to me, but I’m guessing that you did not apply the correct shader.

magic.lixin

sorry, the link should be fixed now, I can`t find a way to apply shader to UIElement.

OvermindDL1

On your custom Material do something like:

material->SetTechnique(0, sdfShader)

And you can also set the shader parameters as necessary to set an effect if you want, one or the other of (or none for normal text):

material->SetShaderParameter("ShadowOffset", shadowOffset);
material->SetShaderParameter("ShadowColor", shadowColor);
// -- or --
material->SetShaderParameter("StrokeColor", strokeColor);

I’ve not tested the above yet, though probably should, would be nice to use SDF in my UIElements as well so I know the text scales well on different screen sizes, would be nice if SDF were default, though I can see why it is not until it is fully refined with a good source.

magic.lixin

UIElement has not function to set custom material, also by looking through the implementation of UI::Render, there is no way to set custom shader, I think it`s not a big deal, I can live without that :smiley:

thebluefish

TBH this is a relatively easy fix.