3
$\begingroup$

I'd like to shade the edges of my objects darker, like a toon shader, based on abrupt Z depth transitions to neighboring pixels -- in other words wherever the Z gradient is high, darken the image. I imagine that can be done in the compositor (?), but can it be done in object space in the material shader editor?

Something like this (not from Blender): Real images on left, Z-edge shaded on right

$\endgroup$
6
  • $\begingroup$ Can you show an example of result? $\endgroup$ – Carlo Jan 19 at 20:31
  • $\begingroup$ Added a couple of samples of what I'm looking for. $\endgroup$ – GaryO Jan 19 at 20:50
  • $\begingroup$ Have you tried freestyle? $\endgroup$ – susu Jan 19 at 20:54
  • $\begingroup$ blender.stackexchange.com/questions/192498/… $\endgroup$ – susu Jan 19 at 20:56
  • $\begingroup$ I have tried using Fresnel but that's only based on the normal (dot product of normal and eye vectors), not Z distance discontinuity, so it doesn't pick up edges of a flat object. Works OK for spheres though. $\endgroup$ – GaryO Jan 19 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.