Outlines of TechnoTsunami

TechnoTsunami Outlines4

Recently I needed a way to separate usable items from other objects at the scene. Like used in many games I believe the best way is using outlines.

I did follow some tutorials but none of them was perfect for my needs.

Outline Tutorial 3

One really good material was from Unreal’s Example Content Maps (M_Highlight). It has really clean lines and it uses Custom Stencil Texture which i need because i want only certain objects to get outlined. But it has one major issue.

Outline Tutorial 4

Because it is using a Custom Stencil value every object using the same stencil value is merged together at the final image. 

Outline Tutorial 6

Second material I found at an old Unreal forum post shared by user mAlkAv!An . It is using a Custom Depth texture but issue of this it doesn’t draw clean outlines around objects it’s also outlines insides too but it’s good because you can separate objects from each other using a distance threshold.

So the answer was really easy, merge two materials together. Separate objects from each other with a threshold and mask the outlines inside the object and combine with Custom Stencil outline and fill the holes caused by the merging of same stencil valued objects.

Here is the final material. It has some minor issues but it does the job. You can get it from this Pastebin link.