Add a sobel edge to a procedural mesh

I have followed this post, Looking for a basic Sobel Edge Post Process Material? - Community Content, Tools and Tutorials - Unreal Engine Forums, to add a edge to a procedural mesh. But I can’t get the same result.

I’m using Unreal Engine 4.11.2. I have downloaded and followed those instructions. I have set ‘custom depth = true’ in my procedural mesh, set ‘custom depth = true’ but I got these errors:

Error [SM5] Missing Material Function
Error [SM5] (Node If) If input B must be of type float.
Error [SM5] (Node SceneTexture) SceneColor lookups are only available when MaterialDomain = Surface. PostProcessMaterials should use the SceneTexture PostProcessInput0.

And when I open the project I get this error also:

Error /Game/Materials/MI_SobelEdge : Can’t find file for asset. /Game/Materials/SobelEdge/M_SobelEdge
Info Failed to load /Game/Materials/SobelEdge/M_SobelEdge.M_SobelEdge Referenced by MI_SobelEdge

I have solved all these errors changing SceneTexture:SceneColor with SceneTexture:PostProcessInput0. But, without any error, I still don’t see the sobel edge. Any idea? This is very frustrating.

I have continued searching and I have found this article,, downloaded and followed its instruction and it works! I have done it on the same level. The only thing I’ve done is to change Blendable on PostProduction Volume.

Why I can’t get sobel edge example working?

My goal is to draw a procedural mesh. It has to be transparent but I want to show its edge. In other words, I want to draw its perimeter.

that sobel edge material you linked to is a bit frustrating to work with. it contains a material function that is in the wrong place when you download it (the ‘Error [SM5] Missing Material Function’), so you need to open it up and fix it.
also as i understand it that material *doesnt *draw the post process effect if the object is using custom depth, so if you only want edges on the procedural mesh i suggest inverting that part of the material (delete the highlighted node here):

Yes, yesterday I saw that error on Material Function. I’ve been searching but I haven’t found how to fix it. Because it’s talking about it can’t apply Depth if the material isn’t a Post Process material (or something like) but on the material function I haven’t found how to set the material to that kind of material.

I’ll continue trying to fix it. Thanks.

material functions cant be set to anything because they are just groups of nodes. consider them just a collapsed comment block. they are set to whatever material you put them in.

I’ve uploaded a version of this that I’ve been working on, its the best approach to sobel edge detection that I’ve found (and ive messed around with a few different versions people have shown).
as i mentioned before, just remove that ‘1-x’ node from the render custom depth comment block and the edge detection will only apply to objects with custom depth enabled, like your procedural mesh.

Thanks!! It’s working!!

I have two more questions:

  1. How can I change the edge colour?
  2. This is not very important but I have tested with a translucent colour and I don’t see the edge. Is there anyway to show the edge when opacity is 0?

Again, thanks a lot.