Because I want the effects of this edge detection to interact with the environment (i.e, with an emission node), I need to figure out how to do edge-detection within a cycles material.
The process, from my understanding, is to find a change in normals and z-depth, both of which are available within the material. The issue I am having is how to find a change in those values. I can’t seem to find how I would access adjacent values, to find what the difference would be.
I already set up a simple visualizer for and shading I am doing that displays vectors as emission colors.
The only way to do it in render, is to use OSL and trace samples to get the derivatives, or use the Dx(), Dy() functions (both for camera space).
But remember that cycles works in world space, and most of the rays being sampled are not camera rays. So the Ray Length may not be the Z Depth you’re after…
For a more practical solution, texturing those edges can help you do it at render time; but better would be to do it at composition (thought I don’t really understand the effect you’re looking for). You may also want to try the Pointiness value and see if that fits.