SDF Text Parameters node
Note
Use this node only in shaders with Material set to UI for UI Toolkit. Using it elsewhere can lead to unexpected behavior or errors. For information on how to create shaders for UI Toolkit, refer to UI Shader Graph.
Outputs the text parameters that UI Toolkit resolves for the current SDF text element, including outline and shadow colors, dilate, offset, softness, and synthetic bold values from the element's styles.
Use this node to read a parameter, such as the dilate applied to bold text, and derive your own value before you connect it to the Default SDF Text node. If you connect each output to its matching input, the text renders the same as it does with the default shader.
This node doesn't output the face color. To read the face color, which is the element's tint, use the Element Tint node.
The Outline Dilate, Shadow Offset, and Shadow Softness values are fractions of the Padding of the font asset, so they behave the same with any font. A value of 1 is as far as the padding allows. Dilate ranges from -1 to 1, where 0 is no dilation.
For content outside SDF text, such as on solid backgrounds or bitmap text, all outputs are zero.
Use this node in both the vertex and fragment stages.
Ports
| Name | Direction | Type | Description |
|---|---|---|---|
| Dilate | Output | Float | The additional dilation of the glyph shape. Positive for synthetic bold. |
| Sharpness | Output | Float | The sharpness of the glyph edges, from the font atlas sharpness. |
| Outline Color | Output | Vector4 | The outline color, as straight (not premultiplied) RGBA, from -unity-text-outline-color. The alpha is zero when the outline width is zero. |
| Outline Dilate | Output | Float | The outline width, from -unity-text-outline-width. |
| Shadow Color | Output | Vector4 | The shadow color, as straight RGBA, from text-shadow. |
| Shadow Offset | Output | Vector2 | The shadow offset, with x to the right and y down like the text-shadow offset. |
| Shadow Softness | Output | Float | The softness of the shadow edge, from the text-shadow blur radius. |