4

I have a super simple material using a grayscale bitmap.

enter image description here

The ramp defines the threshold on what part of the blacks and whites I get.

enter image description here

Is there an "edge detect" node I can use next to this color ramp node? Here is what I need.

enter image description here

Rafael
  • 442
  • 3
  • 14

1 Answers1

4

An edge detect, in something like GIMP, is a convolution. You sample 9 (for example) pixels, and you read each, and you apply math to each. Examples, including for edge detection, exist at https://en.wikipedia.org/wiki/Kernel_(image_processing) . You can do this-- if you know your image size, you can read one pixel to the left, one pixel above, etc, and do your math on those. To save you some trouble, I've already made one of these, a customizable 5x5, 25 pixel convolution, at https://blendswap.com/blends/tag/convolution . It's fantastically out of date. I think I made it for 2.78. But nothing it depends upon should have changed.

Let's be clear, a convolution like that acts in texture space. The edges provided are one texel large, not one rendered pixel or rendered sample large. And when used in a shader, it exists on the surface of your model. If you want it in screen space, you should be able to recreate a convolution in compositor nodes instead, although I wouldn't want to myself-- Blender's compositor nodes do not make it easy to sample arbitrary positions. You could instead render, stick it on a plane with a convolution material reading your render, and re-render.

There are a few things that Blender does that are a lot like convolutions, and those might be desirable instead. One of those is a bump map. We might consider reading the difference between the normals provided by a bump map reading your image and the base normals:

enter image description here

Using your grayscale image. I didn't think it was important to correct the aspect.

This acts in a different space than a pure shader convolve. For Eevee, it acts in screen space; for Cycles, it's something like that, but I'm not very confident about exactly what a Cycle's bump node samples. To tune the thickness/extent of the edges, you can adjust the value in the less than node.

Since bump mapping is not something that you can do in the compositor, this is appropriate only for shader work. But, again, you can always render, plop it on a plane, and re-render.

Nathan
  • 24,535
  • 1
  • 22
  • 68
  • Ty! I'll take a look at your old nodes. But this is making me think that it will be easier to do an image sequence on Gimp and use an animation at the end. – Rafael Jan 21 '24 at 20:44