Looking for a basic Sobel Edge Post Process Material?

Kicking a dead horse <3. I’ve changed this to being EVERYTHING ont he screen to only using custom depth pass. and added a few more options to it.

UPDATES:
SHOWING TRANSPARENCY + EDGE DETECTION:
I"ve updated the material to be able to support transparency (Holograph material - another post process) and still show the edge detection. Basically throwing an IF statement behind the multiply node before in the composite section (See below). If the scenedepth is greater than the custom depth, then show the postprocessinput0 (allowing other postprocessing materials to show through - which is exactly what the holograph material is). If its less (behind an object thus it is occluded) - still show the outline but not the post process (the Scenecolor). Below are the outcomes!

WANT TO PRODUCE:
Does anyone know how i can go about changing the color on this post process effect? I’d like to change the edge coloring to a vector3 color and not just black. I’ve tried several points of interjecting but it floods the entire scene and not targetting the edge detection solely…

Material Setup/Addition:

Showing Transparency (Holograph):

BEHIND/OCCLUDED:

Hey Allar, fantastic job with the material, its much appreciated. I’m having an issue where the effect doesn’t work very well for large landscapes and I remember that this was an issue with the Sobel Post Process in UDK. Chris Holden ( http://chrisholden.net/ ) had his own version that fixed the issue but I’m not at sure how he did it. Does anyone have any idea how to fix this issue because as it stands, its pretty much useless for large outdoor scenes, especially if they have grass in them.

There are many solutions, some have been mentioned in this thread already.

  1. use world normals instead of depth to find your edges
  2. fade your edges out depending on depth to avoid the problem
  3. lerp between world normal found edges and depth found edges using depth as the alpha. This way you can use a combination of the two if you prefer depth edges closer to the camera.

As for the guy before that, I know he posted a year ago, but if you want coloured lines you need to do is lerp between a line colour and your scene colour using the lines as an alpha.

Hopefully that helps.:slight_smile:

Gonna necro, bare with me.

Getting a weird sandy effect on my camera instead of the sobel edge. Im guessing it’s due to missing functions in the material…

Anybody know how to fix it? Or another download?

Dont know if you saw but just check a bit higher on the thread DanYouhon posted a solution to the missing functions.

Gonna necro, as I was able to fix the outline so that it doesn’t have the weird issue where it blacks out distant objects. Use the above mentioned technique to do edge detection on the r, g, and b channels of the normal pass, multiply them, then lerp between that and the depth pass, using sceneDepth/128 (<- you can use a lot of numbers to get that where you want it, notably. The higher that number, the weaker the depth pass is) as the alpha. This will give you the less accurate normal edges for distant objects, and the more accurate depth pass for near objects. I think the result looks pretty good: http://puu.sh/ni7sY/165a2f9d15.jpg http://puu.sh/nibJM/53aa928030.jpg (toon shader from Toon shading model - Game Development - Epic Developer Community Forums )

That’s pretty cool. I like it.

Hi,
I downloaded the material and it gave me an error as scenetexture:scenecolor is not available anymore in postprocess materials.
I tried to replace it with postprocessinput0 and it compiles but it doesn’t work. Does nothing. Is there a way to fix this?

Thanks for sharing, but I can’t see the edges. I’m using Unreal Engine 4.11.2 and followed everything you said on your post, but I can’t see the edges. Do I have to do anything else?

And also, I get three errors in material:

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

Any idea? There are a lot of undefined functions in the material.

By the way, I’m new in Unreal Development.

This is like two years old. We now have the ability to use custom stencils.

This is the way to go about this now: http://www.tomlooman.com/multi-color-outline-post-process-in-unreal-engine-4/

but that thing is highlight outline material, not a sobel edge detector, even though is a great way to do an outline, it doesn’t work for those who want to make an entire scene to look like a game like borderlands for example

Since SceneColor cannot be used anymore in postprocess materials then how do you change the occlusion code ?

This is pretty much an old thread but I thought I’d comment just in case, since there are probably still people who download those materials.
There is a small error and it’s funny no one has ever pointed it out: the offset for +X, 0 (the fifth append from above) is not correct. Instead, it uses 0, +Y, which already exists at the 2nd append from above.
That means that it checks the pixel above twice and the pixle to the right not once.

It’s only a small difference and since it is only one check out of 8 that is wrong, the visual difference isn’t that great, but it is wrong and should be noted.

can you edit the .zip to the correct values, and make it work for U5.4, please?