This patch adds a new line node for material node graphs. It aims to support both Cycles and EEVEE.
In Cycles works similarly to the AO node, by raytracing towards contiguous pixels and in EEVEE by reading the depth buffer.
In both cases it outputs the distance between the expected point it should encounter (assuming it's coplanar to the currently shaded pixel) and the actual point on the mesh/scene.
Right now outputs the max and min (as max negative) distance from surrounding pixels.
In Cycles it also outputs an outline based on object ID.
For further documentation and a build check https://blender-outline-node-docs.netlify.com/.
Know limitations/Current issues
- In Eevee, it doesn't work for alpha blended objects, I don't think there's a simple solution for that and will likely stay that way.
- In Eevee, distant objects tend to output slightly off results due to numerical precision. In practice, it's solved by dividing the node output by Width WorldSpace Size.
- In Eevee, subpixel line widths are supported by rounding up or down the width based on probability. Ideally it should be rounded based on the camera jitter offset.
- In Cycles, object outline works in viewport but not in render. (???)
- In Cycles, rays should ignore fully transparent pixels. (This problem is also present in the AO node)


