|
|
|
|
@ -66,15 +66,16 @@ utility.
|
|
|
|
|
For each pixel inside @p rectangle the algorithm looks at corresponding pixel in |
|
|
|
|
@p input and tries to find nearest pixel of opposite color in area given by |
|
|
|
|
@p radius. Signed distance between the points is then saved as value of given |
|
|
|
|
pixel in @p output. Value of `1.0` means that the pixel was originally colored |
|
|
|
|
white and nearest black pixel is farther than @p radius, value of `0.0` means |
|
|
|
|
pixel in @p output. Value of 1.0 means that the pixel was originally colored |
|
|
|
|
white and nearest black pixel is farther than @p radius, value of 0.0 means |
|
|
|
|
that the pixel was originally black and nearest white pixel is farther than |
|
|
|
|
@p radius. Values around `0.5` are around edges. |
|
|
|
|
@p radius. Values around 0.5 are around edges. |
|
|
|
|
|
|
|
|
|
The resulting texture can be used with bilinear filtering. It can be converted |
|
|
|
|
back to binary form in shader using e.g. GLSL `smoothstep()` function with step |
|
|
|
|
around `0.5` to create antialiased edges. Or you can exploit the distance field |
|
|
|
|
features to create many other effects. See also @ref Shaders::DistanceFieldVector. |
|
|
|
|
back to binary form in shader using e.g. GLSL @glsl smoothstep() @ce function |
|
|
|
|
with step around 0.5 to create antialiased edges. Or you can exploit the |
|
|
|
|
distance field features to create many other effects. See also |
|
|
|
|
@ref Shaders::DistanceFieldVector. |
|
|
|
|
|
|
|
|
|
Based on: *Chris Green - Improved Alpha-Tested Magnification for Vector Textures |
|
|
|
|
and Special Effects, SIGGRAPH 2007, |
|
|
|
|
|