Material for Orange Outlines on Selected Actor

Hi there,

when you select actors in Unreal Engine editor, they get an orange outline around them. I want this same behavior ingame (for character selection screens and stuff like that), but I looked all thorugh the engine content and couldn’t find the material that is responsible for this effect. Can anyone help out? Or alternatively help me recreate this effect with an own material?

Thanks in advance

You could make the material of the selected object output to CustomDepth when it gets picked, and then in a fullscreen post process pass you can do your outline math using the custom depth as your source for computing outlines.

The wiki has a great example of how to do this; Post Process Materials | Unreal Engine Documentation

Thanks for the reply.
I think this isn’t exactly what I need, though. Since that material adss outlines based on the depth buffer, a selected object might have multiple outlines depending on its geometry (see the second mesh in that example). What I rather want is just a single outline around the whole object, just like UE editor is doing it. I don’t think this can be done with just the depth buffer alone. I guess it needs a rendertarget or something to work.

Take a look at this thread: Object / Mesh Outline Effect working - Epic Games Forums Probably this UDK tutorial is still working in the UE4 :slight_smile:

Thanks, that’s getting closer already. But judging by the screenshots that method still seems to have some issues. Like: The character (in the second screenshot) has an outline around his whole left hand, he has random red dots on his knee and he barely has any outlines around his feet. UE4 editor’s approach is still somewhat better. Something like this is what I want:

For example: geometry, that is close to each other in screen space (like the characters on the right) should share a single outline instead of each having an outline of their own.

Not sure if it helps but here’s one way of doing it:

No, the presented solution only applies to spheres as he uses the PixelNormals to generate the outline and looks ugly on other objects:


I was just reading through some articles posted on a blog, and happened to come across this, so I thought I would give you the link.

This is a tutorial that goes over exactly what you are looking for, breaks it down step by step, and even has a sample project you can download (including a sample material). His material is blue, but that is not hard to change:

Hope that helps! :slight_smile:

That’s a nice blog post but you really don’t need to use the sobel operator for some plain edge detection.

Here’s a simple material which should do the job:

The threshold parameter defines the distance in world space up to which geometry shares the same outline. Note how in this example both spheres have a single outline whilst the bush in the background gets separated due to the distance exceeding the threshold:

Thanks, DotCam and mAlkAv!An! I think that is actually what I need. That should solve my problem. :wink:

I have another question now. I want to use this same effect (I used the one from the tutorial) on a scene capture, but it won’t work. I added PP_Outliner_Inst to the SceneCapture’s Blendables List, set Blend Weight to 1.0 and set Render Custom Depth on some meshes to true. The outlines are visible on all regular cameras, but not on rendertargets that I write to with this Scene Capture. Apparently there was a bug on UE 4.0.2 where the engine ignored Blendables on Scene Captures. I’m on UE 4.1.1, though. Wasn’t the bug fixed by then? The thread where I read about the bug also has a link to a proposed fix of the bug, but since I don’t currently have a UE subscription (and am completely broke) I can’t open that link (it’s on Epic’s github page), so I’m unable to find out if it’s the same bug and if I can fix it.

This is the thread I’m referring to:

And this is where the proposed fix can be found:

Is someone here able to see that page? If so, can you quote how to fix the bug for me? Thanks in advance!

Hi there,

I would love to use that material in 4.9+. I had to make some small modifications to compile it:

(Here’s the code for copy&pasting: Begin Object Class=MaterialGraphNode_Root Name="MaterialGraphNode_Root_1" Be -

(SceneTexture:SceneColor now has to be SceneTexture:PostProcessInput0 and I had to mask out alpha before the lerp-node at the end).

Unfortunately it just renders the whole screen with the outline color now:

Did I make any mistake? I just added an unbounded post-processing volume, added this material as a blendable and activated ‘render custom depth’ for a mesh in the scene…

Works perfectly. Kudos for posting this. :slight_smile:

You are dividing by 0, fix that and it works…


Soooo, this shader broke in 4.9+. Anyone have any ideas why?

EDIT: Fix found here. Basically just 1 node needs 1 setting changed. Easy to fix:

Does this shader still work in 4.14? I tried to recreate it and it isn’t working for me, only rendering the shape as black with no outline.

This is my setup, I also have a global post process volume in the level that has this material in the blendables tab. What am I doing wrong?

It appears to still be working for me in 4.14, you can look in the Squad SDK for the Content/Materials/PP_OutlineColored to get the following…


Using this, great blueprint, allows you to have multiple colors on multiple objects in game.


Yep, I started here and then eventually looked at what Tom provided, which is a great blog / resource and everyone should subscribe. I forget how much of what came from what but I think ours mostly came from Tom’s work.

You didn’t give the Outline Size a value. It needs to be 1 or more not 0. Also Your threshold number is really low. That needs to be increased as it’s the world space distance that the effect works at. Try a value of 20480 or higher. This thread is like a game of telephone, everyone changed the values just a bit and now it’s all muddled.