Simple Outline Shader (Extended Standard Shader)

Hey guys,

After searching for a solution to highlight some objects in my project I concluded I want something like an outline.
Finally it seemed, that the best solution was to get this with a shader.

However most solutions on the internet didn’t work out and the asset store didn’t have free outline shaders.
I wanted the benefits of the standard shader + the outline.

Therefore I mixed the standard shader with an additionall outline pass and rewrote the ShaderGUI.

I wanted to post it for free on the asset store, but to become a publisher is too much of a hassle.(There has to be a dedicated website and support contact etc.).

Now I’ll just want to post it here for free, so anyone who just needs a simple outline but doesn’t want to pay or write one himself can just use it.

There still is the problem with the outline not looking correctly for edges like the Unity standard cube. Therefore you can use an imported cube mesh with smoothed edges. (Look in my unitypackage, you can use that cube there).

Screenshots:

Outline_Shader.rar has the Shader and the ShaderGUI.

The Unitypackage additionally has the tescene, where you can click on certain primitives with a red outline, and they get selected and change to a green outline.
It also contains the new cube, with fixed outline and you see the difference to the standard unity cube.

If you have any suggestions, you can tell me and I’ll try to implement them, when I have time.

2644700–186257–Outline_Shader.rar (6.13 KB)
2644700–186258–outline.unitypackage (38.5 KB)

3 Likes

Hi Timotheus,

currently I am trying to find a shader to visualize outlines in Unity. I already tested serveral shaders including yours. However I always end up with very thin outlines. In the screenshot I used your example scene with the same settings. The outlines are nearly not visible at all. Changing the Outline Width to 0.02 only makes a minor improvement.

I am using Unity 2017.1.0f3. Did you experience something simliar for the newer Unity Version? Or do you have a idea to fix this problem?

Thank you for your feedback!