4 different approaches towards making some great looking outline, selection or highlight effects in Unity.
The order I've listed these in doesn't matter. I was looking for an outline effect for one of my projects and I came across all of these. They are all free and they're all clearly made just as examples of what's possible or to solve a particular problem so I'm not going to say one is better than another. I'm currently trying to learn from them and combine various features from all of them in my own effect, and I suggest that's how you should approach them as well. They are all easy to integrate into your project and activate on mouseover, click or whatever else you need them for.
The first effect, created by Kenneth Otto Larsen, is the simplest and in my opinion the most robust, it's hard to break this one. It's just a single shader, and from what I can tell it works by just "pushing out" the normals of the object to create the outline. There are a few limitations to this approach which should become apparent when you use it.
You can read more about the effect and get the shader from Kenneth's website, here:
The second effect is made by Will Weissman. It's basically a complete tutorial and it works very differently from the first one. Whereas the first one is used just as a material this one is used as an image effect. You have to assemble it yourself and you end up with a couple of shaders and a script which does some work involving a second camera and a render texture. For me it was hard to get this effect working and it seems a bit unoptimized. But it's a post processing effect which has some great benefits, it's also not a solid outline, but a glow, which is nice if that's what you're after.
You can follow the tutorial on Will's blog, here:
This third effect by José Guerreiro seems to be the most battle tested of all of them. It works very similarly to the second effect, but feels a lot more optimized and has various options to play with. It doesn't have the ability to create a glow from what I can tell.
You can download the effect from José's Github, here:
The last one is again very different from the first 3 and it's hard to imagine there are this many different ways of making an outline effect, but apparently there are. It's made by Victor Apihtin and it involves Command Buffers from what I can tell, even though I have no clue what they are. It's also basically a complete tutorial with a very solid end result. This one also functions as a glow by default.
You can follow the tutorial, and download a package with the effect, from Victor's blog, here:
Add new comment