[FREE] [OPEN-SOURCE] Outline Effect

Update 2019-10-11:
Hello guys!
Sorry but it’s really hard to maintain an open source project while still working full time, I will do what I can…
Someone has been working on the project and I just merged his changes.
If you’re interested in seeing what has changed, check out the fork: GitHub - JimmyCushnie/Outline-Effect-but-its-faster: a fork of Outline Effect with improved performance
For the latest version go to: GitHub - cakeslice/Outline-Effect: Outline Image Effect for Unity
I will release it in the asset store soon :slight_smile:
If you find any bugs it’s better to post an issue on GitHub where we can track it. Use this link: Issues · cakeslice/Outline-Effect · GitHub
PS: Many thanks to JimmyCushnie (Jimmy Cushnie) · GitHub !!!
----------------------------------------
Outline Effect for Unity

FEATURES:
Sprite/Line/Mesh renderer support

HDR support (useful for bloom, etc…)

Alpha cutout option

Additive outline rendering option

Merged outline between renderers (or you can add outlines between different colors)

Erase option to keep outlines behind specific renderers

Per renderer color support (up to three different colors)

USAGE:
Add “Outline Effect” component to camera

Add “Outline” component to renderers

TWITTER:
cakeslice_dev

DOWNLOAD:
github.com/cakeslice/Outline-Effect

28 Likes

http://github.com/cakeslice/Outline-Effect

i cannot seem to open that binary demo scene or i think it is empty
you can force text in editor settings so the demo scene gets checked in as text instead of binary

tried following steps but…

looks great! thanks a lot

1 Like

I’ll check it out. You’re welcome :slight_smile:

1 Like

Hello, just found this, great asset. However, I have one problem with it :slight_smile:

Your demo project works correctly, however in my own scene, the sprite outline is mirrored on the y axis in screen space (if the sprite in at the botton, the outline is at the top, vertically mirrored). I tried to set up everythng like in you demo scene. Any ideas? :slight_smile:

Edit: This happens with an othographic camera.

1 Like

Thank you, this is awesome.

Same issue here! Would love a fix

Just added an option to fix this problem (“Flip Y” on the effect component). Get it on github!

1 Like

You are awesome dude! Thanks for the fix!

I have another question if you don’t mind :slight_smile:

I use your asset to draw an outline around item sprites when the cursor is above them. When no item is under the cursor, The outline should disappear. Currently, in Update() of my cursor script I just cast the ray and check if it hits an item, and if yes, then the outLineRenderers list from the Outline script is created anew with the item’s renderer as the sole element. If the ray doesn’t hit an item, the list just gets cleared. What happens is that an error message is thrown by the OutlineEffect script

Attempting to release RenderTexture that were not gotten as a temp buffer

I wonder if it’s save to ignore it; might there be any render texture bleeding or similar?

Edit: Just solved it. I just set the renderTexture to null at the start of preCull whenever I have changed something in the outLineRenderer list.

Hi, thanks a lot, you are a life saver! Althought could you help me to make the outline be black. I was searching for several days and started learning shader thingy, but really I can’t seem to figure out a way to remove transparency when the color is black… Thanks a lot anyway!

This kicks ass! NIce job, dude!

Having a weird issue where the whole shape is drawing … well, oddly. Any ideas?

Instead of being outlined.

Update:

Patched to unity 4.2.1p4 and that fixed part of the shading, but is still quite far off:

A frame dump of the working project (yours) shows this at some point:

I am wondering if the material my Image is getting set to is perhaps remaining stuck in this step.

Alternatively, I found that you can add an empty entry to the OutlineRenderers list before adding your own. Which may be a simpler solution.

Just finally implemented this into my project, looks great!
Got the “Temp Buffer” error, but mafia’s suggestion works well.

I love this script so far. I am trying to tweak it to meet my needs but I’ve been having trouble understanding how the outline renderer colors work. If I have more than 3 objects that I want to apply outlines to in the scene, things seem to break down. I had thought that each Outline Renderer Color corresponded to the Outline Renderer of the same index. And that you could go between a value of 0, 1, or 2 to set the color of that renderer to Line Color 1, 2, and 3. But that doesn’t appear to be the case.

I’ve included a screenshot to give you an idea of what I am messing with. The squares in the scene are stacked in the order they appear in the Outline Renderer list. The Outline Renderer Colors are fine up until the 3rd and 4th element in the list. I want the 3rd element to be yellow and the 4th to be red but they’re both green. I’m trying to add specific outline colors to objects depending on their HP. I have a system in place to populate the lists with the appropriate data, but the colors are behaving like they are in the below screenshot. Maybe it’s not possible to accomplish this with the script but I thought I’d ask. Any insight on this would be super helpful. Thank you!

This is fixed in the last version. I also added black/dark outlines functionality :slight_smile:

1 Like

This is a bug. Get the latest version on Github for the fix! You’re welcome :slight_smile:

You’re beautiful. Gonna try it tonight and see how it goes. Although I think I found an alternative to accomplish what I need. But it will be useful regardless. Thank you!

It does not seem like the “outline” layer is used by the script when it draws the outline, is this correct?
I wanted to add a blur to the outline, so I tried to cull the outline from the main camera (so I could pick it up on another camera with a blur effect), but even when all layers are disabled on the main camera, the outline is still drawn.