Catlike Coding
Unity Code Documentation
|
Utility class for generating signed distance field textures from anti-aliased alpha maps. More...
Static Public Member Functions | |
static void | Generate (Texture2D source, Texture2D destination, float maxInside, float maxOutside, float postProcessDistance, RGBFillMode rgbMode) |
Fill a texture with a signed distance field generated from the alpha channel of a source texture. More... | |
Utility class for generating signed distance field textures from anti-aliased alpha maps.
Although the generator can be used at run-time, the current version isn't convenient nor optimized for it.
|
static |
Fill a texture with a signed distance field generated from the alpha channel of a source texture.
source | Source texture. Alpha values of 1 are considered inside, values of 0 are considered outside, and any other values are considered to be on the edge. Must be readable. |
destination | Destination texture. Must be the same size as the source texture. Must be readable. The texture change does not get applied automatically, you need to do that yourself. |
maxInside | Maximum pixel distance measured inside the edge, resulting in an alpha value of 1. If set to or below 0, everything inside will have an alpha value of 1. |
maxOutside | Maximum pixel distance measured outside the edge, resulting in an alpha value of 0. If set to or below 0, everything outside will have an alpha value of 0. |
postProcessDistance | Pixel distance from the edge within which pixels will be post-processed using the edge gradient. |
rgbMode | How to fill the destination texture's RGB channels. |