I need to make an edge detector for normal maps in the material editor.
I’ve figured out how it would do it in theory. It would look at the Red channel and it will look at each pixel and then it’s neighboring 8 pixels. If one of them is significantly brighter or darker from a certain range that I can set, it will be turned black.
The same would be done for the Green and Blue.
All of this then would be added together and multiplied with the diffuse texture. Hopefully giving me a cartoonish look.
The problem being is that I don’t know how I could tell unreal to check pixels against one another and then to tell it to turn that specific pixel black if it’s true. Or if it’s even possible.
(Edit: don't know why the text was black for.)
Oh, just had an idea. What If I duplicate the texture node and use a uv node to tell it to move over 1 pixel. This would place each pixel over a sample pixel and compare those. I would have 8 copies though. One for each direction that it would have to move. But how would I tell unreal to compare the pixels? I think I would have to use an if statement, but I don’t know how I could tell the if statement how much above or below the pixels next to the sample pixel would need to be for it to tell the sample pixel to turn black.
I don’t know if I explained that well.
Oh wait, how can I tell the uv panner to only move 1 pixel?
Replies
It detects the edges.. but only on one side. I understand this is because of the normal map being a gradient and its only picking up on one side of the gradient.
Here is my material.
The only problems that need fixing is that it doesn't really look like an ink line.
The whole, only detecting one side problem.
I only used 5 samples instead of 9 to save on memory. Would missing the diagonal sampling do this?
And it's not to outline an object, just to make ink lines like you would see for muscles in comic books. What are the other ways if you don't mind telling me?
But now it's picking up too much detail. Since this is going to be for a cartoon. I don't know how to tell the editor to only get the bigger changes, and not the smaller details like cracks.
Also, how can I make it more smooth like a pen and less blocky.
take the normal into PS make a cavity map from it with NDO or the xnormal plugins and level it till it is black and white.
i never used it for this purpose but i do use normal2cavity and the resulting cavity map a lot for for highlighting my edges in the spec map.