Conventions
Keen Vectors provides you with the building blocks to create your own shaders that use distance fields, from handy Shader Graph nodes to clear and practical editor GUIs.
To this effect, we define some conventions which can be followed to make best use of the provided features.
The provided importer and shaders all follow these conventions, so if you're only using the built-in tools then you don't need to worry about this.
They are available for runtime and editor scripts through the Distance
Texture Formats
Textures are expected to hold a 3-channel distance field encoded in the RGB channels, and a simple true- or pseudo- distance field in their alpha channel.
The presence of the color and alpha channels is used by editor tools to deduce if the texture provides this information. This means that if you have a texture that only has a simple distance field, it should be encoded on the alpha channel, and the texture should use an alpha-only format.
Shader Properties
Texture properties that are to be treated as distance fields should have an accompanying float property with the suffix
_PixelRange.
Shader Keywords
Shaders using Pixel Range Input, which includes the built-in MSDF Sprite expect two sets of shader keywords to be respected. Of each of these sets, exactly one of the keywords must be enabled at a time, or the result is undefined.
Pixel Range Source
| Keyword | Description |
|---|---|
_PIXEL_RANGE_SOURCE_MATERIAL |
The shader will read the pixel range from a material property. |
_PIXEL_RANGE_SOURCE_UV1, _PIXEL_RANGE_SOURCE_UV2, _PIXEL_RANGE_SOURCE_UV3 |
The shader will read the pixel range from the specified UV channel's X component. |