How To Hide Post Process Outlines When Object Is Occluded

Hello. I followed this tutorial to make a post process material for some of my objects as there are certain points in my game where I’d like them to glow so the player knows that’s the next step.

and the code used for the “neighbouring pixels” node is available on the hyperlink of the tutorial I followed.

I just would like to know if there’s a way to not have the outline shown if the object is occluded behind another object. I followed another thread on here, but that didn’t work for me. Any help would be appreaciated!



You need to set the custom depth mask of the occluder to 38 for it to work.
My small box has the custom mask set to 1 and color to red
The wall that covers it is set to 38.

The outline gets culled

Did you download the correct shader?

Download M_Outline occlusion v2 v4.20+

Because you are missing the needed mask depth calculations in the if statement.

1 Like

I didn’t download a shader for it, I just followed the tutorial and made a material, but thanks I’ll try your way. I’m now also having another problem where the glow I’ve added isn’t working:

My outline colour just goes from black to yellow, instead of having the pulsating glow like in the tutorial.

What do you have connected to the “B” link and the “A>B, A<B” links

It’s a max of the custom stencil mask (R) and the neighbouring pixel. Look in the shader.
It has some extra clamps to limit it to the 0-255 scale of the custom buffer.

Try:

M_Outline_occlusion_v2.uasset (31.3 KB)

Hello, using the shader worked absolutely fine and had the glow working, as well! So thank you anyway! :slight_smile: