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/.
{F8432023}
{F8432022}
**TODO/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, it requires a full resolution depth buffer. (Enabled in eevee_effects.c for now) Not sure about the full implications of it, aside from performance. Could be an option in Eevee settings or just render by default at full size. I guess the performance hit could be outweight by re-using it in the main pass to avoid pixel overdraw ?
- In Eevee, distant objects tend to output slightly off results, probably 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.
- I probably should rotate the offsets per sample for better quality on thick lines.
- I'd like to provide a normal based delta (the min dot between current pixel normal and surrounding pixels normals). And ideally object, island and mask color too. In the case of Eevee render pre-passes would be needed.