I’ve been working on an edge detection post process last week and I would like to share it with you.
First, few screenshots to show you the result :
To summarize :
I started from this tutorial that use a sobel operator.
Tutorial – Creating outline effect around objects | Unreal Engine 4 blog
(a great start if you want to understand how edge detection works)
I modified the texture sample to add more details to the edges. Instead of just using the depth, I converted the world normals to view space and created a Vector3 with (Normal X, Normal Y, Depth).
(Inspired by a post from William Chyr and Lucas Pope)
Return of the Obra Dinn [Releasing Oct 18]
I also added a falloff to reduce the intensity of the normals and the depth, so I avoid noisy details in the distance. I used a log2 falloff to keep some nice details at close distance even with a high max distance.
The normals and depth have a different falloff. I find it nicer when the depth maximum distance is higher to just have the outlines of far objects.
I share the blueprints (sorry for the bad screen quality but if you know how to take good quality screens of BP, just tell me), feel free to use it or modify it.
If you have any feedback to improve the detection quality, optimisation tricks, or any feature that you might think could be useful, tell me.
I hope it will help you