MSDF Decal
Draws a decal to the Albedo and Normal channels, using a distance field as a mask for traditional textures.
Supports generating bevel-like normals from the shape's contour.
Important
This shader only works correctly in the Universal Rendering Pipeline. If you are using a different pipeline, all features are exposed as sub-graphs for you to build your own.
Surface Inputs
Name | Property ID | Description |
---|---|---|
Distance Field | _DistanceField |
The distance field to use for all effects. |
Pixel Range | _DistanceField_PixelRange |
Pixel range of the distance field, automatically detected by the inspector. Must be provided manually when creating materials programmatically. |
Base Color | _MainTex , _Color |
Albedo texture and color tint, defaults to white if not provided. |
Normal | _Normal , _NormalStrength |
Traditional normal map texture, and a strength multiplier to control how proeminent it its. |
Normals from Contour
Name | Property ID | Description |
---|---|---|
Blend | _NormalMapBlend , _USE_CONTOUR_NORMALS keyword |
Controls the portion of the normal that will come from the generated contour, versus from the normal map texture. 0 means it comes exclusively from the contours, 1 from the texture. |
Blend With Base Color Alpha | _BLEND_NORMAL_MAP_WITH_BASE_COLOR_ALPHA keyword |
When set, will use the normal map's alpha channel to control the blend, by multiplying the alpha value with the blend value set in the material. |
Smoothness | _NormalSmoothness |
Controls the rounding of sharp edges and the high point of the bevel. Higher values make softer normals. |
High Point | _NormalHigh |
Distance inset from the shape's contour where the normal is assumed to be flat. You can also think of it as a "bevel width". |
Note
When creating materials programatically, be aware that the _USE_CONTOUR_NORMALS
must be enabled for normal generation to occur, otherwise only the normal map will be read.
This is taken care of automatically by the material inspector for materials created in the editor.
Warning
Smoothness values too close to 0 can generate flickering artifacts.