Need help with a sobel edge post process effect :(

i’m working on a game with this post processing effect that calculates the edge of an object or image, i decided to get one from the stylizedrendering example from the engine, but i couldn’t manage to get it work, then i found one from another guy, and it has an error, well basically, is too old and many things have change from the past 2 years, so i finally managed to come back and decided to work around with the one from unreal engine, but apparently not working, cause i get this weird papercraft effect

also, for some reason, i started to work on another project and tried the second method and strangely started to happened the same effect.

this is the where i found the sobeledge effect Looking for a basic Sobel Edge Post Process Material? - Asset Creation - Unreal Engine Forums and the other one is from unreal engine examples.

so if i put the material instance in the postprocess cube, i get nothing, if i put the base material, i get this

the palid brown color is the thing i want to fix, but the thing is, the last part of the blueprint is a postprocesstexture input0 and wants me to blend the material with a color, and the result is that one you see here, sadly i couldn’t manage to get rid of that, i’m not exactly a blueprint expert :frowning:

1 Like

bump, really nobody knows how to fix this? i also found the toolman’s highlight material tutorial, but isn’t exactly the method to make this sort of borderlands outline effect, by the way, this is the pic of the blueprint where i need help

this is the part where it blends the palid brown color, i change it to white now, and this is where blends the line color and all the sobel edge calculation is behind this and sorry for filling up this thread with big files and all, but i really want to makes this to work :frowning:

That first PostProcessBlendWeight is kinda odd, not sure why do you need that. All that will result is a white pixel when you set it to 1.0. No reason for that.
The second image have no context. The A input should be the SceneTexture:PP0 input from the first image, the B is the color you want to apply at the white edges, then theres the alpha channel which is the sobel edge output and you should clamp it between 0. and 1. to make sure no value larger than 1.f will be coming into the Lerp’s alpha. Then it should work, unless the sobel extracting is also messed up in which case you’re better off creating a very simple 3x3 kernel on your own, then apply the two sobel edges (summary of right and bottom sobel), that should work.

dde6f758648468f23d19c89ae73ae63aa46aec6a.jpeg

Here, the custom node is a little HLSL code i wrote that will sample 8 pixels from the neighbours and summarize the sobel (also applying a min[1.f,x]) the way i just described. The floor node will make a very narrow high pass filter (only allow values of 1.), but you can use a pow() node as well that will give broader spectrum for more edges.

1 Like

ok i’ll give it a try, thanks, btw this blueprint works great in the project i took it from, but applied to anything else, doesn’t

edit: it worked flawless :slight_smile: thanks a lot dude, now i need to make the edge to follow the entire mesh and not just the 70% of it

The edge effect works just great on the high contrast areas, but the low contrast might not produce edges for you. Check the threshold in your equation and give a larger spectrum, that could work. Or, maybe it’s the sobel you are currently using produces a value range between -1 and 1, that you should get the abs() of it, so it will outline the lower part of the image as well.

thanks once again dude, you’re being pretty helpful

i found the delta that was calculating the edge of the entire mesh, i messed it up a little bit to see how it works, and it seems that if i decrease the minus number that divides the current edge calculate before, i get this horrid shadow in the distance, but at least i found it 388ca4d3749f73263af0aea11715d88a4fb49523.jpeg

9b052859a96661a472bdd6002a6acaa042d803f9.jpeg

Added this offsetting to the edge output. The offset is .95 and the power node will use a high exponent, 128. The result kinda cool.

210aad7dca5fd3f00b26766b614891bce0ea7c08.jpeg

This of course only will work if your sobel output is not filtered with a threshold, so the low contrast edges can be highlighted nicely.

That most likely is the kernel you are messing with, and the values should already be tuned pretty well to calculate the sobel differences. If you change these values then the original content will slowly slide into the edge channel, and you don’t want to do that. This actually is the reason the black content start to appear.

i made a pretty cool comic effect by increasing a the number a little more, which is the effect i was looking for to make my game :cool:

Hello,do you know how to add a custom node:“the custom node is a little HLSL code”? I failed to add this?

This should help to start and understand the concept behind the Custom Node. I also found the forums have numerous posts that will teach you ways how to access the scene texture from hlsl code, it is quite easy and leveraged to a single function call (SceneTextureLookup) which is cool.

It’s really helpful.I got it. Thank you very much