A compositor node for calculating distance from the nearest masked pixel.

This node is useful for complicated masking and the other various effects.

- "Distance" output gives an Euclidean distance from the closest masked pixel
- "Vector X"/"Vector Y" outputs allow us to obtain information at the starting point of the distance if combining with the Displace Node
- "Invert" option specifies whether to invert the inner and outer areas
- "Relative" option specifies whether to use relative distance
- Included in "Convertor" category

Unfortunately, the DistanceTransformOperation is performed in a single thread, but much faster than the DilateDistanceOperation/ErodeDistanceOperation with large number of steps.

Note: The output sockets are two scalar outputs and have to be connected to the Displace Node's "X Scale"/"Y Scale" inputs, not to the "Vector" input, because the vector input changes the input values by bilinear filtering and produces unexpected results.

Examples:

Distance (normalized)

Use "Invert" option

Stripe

Fake glow

Material color of the nearest object

Voronoi diagram

Masking/coloring toon edges