Outline/highlight objects

Hey all,

So I’m curious as to the best approach to outline/highlight selected objects. I see that there’s both shader and camera effect approaches on the asset store. I’m wondering if there is a “best” asset that exists for this, or if there’s a cheap easy open source solution.

I’d like to avoid the shader route as this seems like it would require me to modify all my existing shaders (I currently use UBER for most of my materials) unless there’s a way to do it with a custom shader that would allow me to preserve the look and feel of the original shader that I’m missing.

The few camera effect solutions that I’ve seen all seem to get marks down for performance, as they all seem to be somewhat expensive and unfit for mobile, and while on desktop I’m sure it will work fine, I tend to want to find the most efficient solution so I can leave as much room as possible for the performance to be dedicated to actual gameplay or truly necessary environmental effects for the atmosphere of the game.

Any suggestions welcome. Just curious what the best way to go about this is.

is this for sprites or 3D objects?

one interesting trick is to add 2 materials to the object, so it gets drawn with each material…
so could add some outline effect material to those that need it.

It’s for 3d objects. Hm… I’ve never added two materials to an object. How is this done? Usually in my experience adding one material replaces the other

in mesh renderer materials, can set more than 1 material to that array
3761272--313714--upload_2018-10-8_9-8-0.png

other other option could be calling DrawMesh() for those outlined objects,
using some outline or extrude shader (drawn behind real objects)

1 Like

This free asset works well, is quick and easy to setup and use and doesn’t interfere with the original material, it also works with deferred rendering, which most outline shaders won’t.

1 Like

For our Mobile Game we’ve tried things like the Silhouette Diffuse shader as well as Multipass Image Effects Scripting. Through testing we came to the conclusion that Silhouette wouldn’t work for Meshes that had hard edges (try it on a cube, looks terrible) while Images effects used far too many draw calls to be considered performant.

In the end we resorted to using MatCap shaders which were conditionally swapped in via scripting when we wanted to highlight something. While not true Outline effects, they are remarkable for highlighting and does the job in communicating UX feedback to the player while also being very performant. Plus they were useful in “lighting up” meshes in statically lit environments.

1 Like

What are the steps after adding the second material? The second material just covers the first one.

2nd material, that uses outline shader, but of course it might be better just temporarily replace main material with outline material then.

1 Like