Browse Source

TextureTools: adapted to the new documentation theme.

pull/231/head
Vladimír Vondruš 8 years ago
parent
commit
4186f05f70
  1. 13
      src/Magnum/TextureTools/DistanceField.h

13
src/Magnum/TextureTools/DistanceField.h

@ -66,15 +66,16 @@ utility.
For each pixel inside @p rectangle the algorithm looks at corresponding pixel in 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 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 @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 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 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 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 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 back to binary form in shader using e.g. GLSL @glsl smoothstep() @ce function
around `0.5` to create antialiased edges. Or you can exploit the distance field with step around 0.5 to create antialiased edges. Or you can exploit the
features to create many other effects. See also @ref Shaders::DistanceFieldVector. distance field features to create many other effects. See also
@ref Shaders::DistanceFieldVector.
Based on: *Chris Green - Improved Alpha-Tested Magnification for Vector Textures Based on: *Chris Green - Improved Alpha-Tested Magnification for Vector Textures
and Special Effects, SIGGRAPH 2007, and Special Effects, SIGGRAPH 2007,

Loading…
Cancel
Save