# How To Hide Post Process Outlines When Object Is Occluded

**URL:** <https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint\
**Created:** [March 27, 2024, 1:54pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595 "2024-03-27T13:54:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![malak03s](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@malak03s](https://forums.unrealengine.com/u/malak03s)\
**Post date:** [March 27, 2024, 1:54pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/1 "2024-03-27T13:54:39Z")

</div>

Hello. I followed [this](https://www.parallelcube.com/2017/12/05/outline-effect-part-1/) 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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/f/1ef04fdb096532da33e37792a75af67eab678c8b.png)

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](https://forums.unrealengine.com/t/disabling-custom-depth-rendering-on-certain-objects/299716/3), but that didn’t work for me. Any help would be appreaciated!

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [March 27, 2024, 2:19pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/2 "2024-03-27T14:19:20Z")

</div>

![mask38](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/7/d070895671466eb59199422c632d160fcaa522f9.jpeg)  
 ![mask38_2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/3/2b326f6240616105a057e8e344c8d5c3a4bff56a.png)  
 ![mask38_3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/e/a6ec36a9ad28cf020000d266e277d1a1fa05a7c2.png)

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+](https://www.parallelcube.com/web/wp-content/uploads/2018/12/M_Outline_occlusion_v2.zip)

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

---

<div class="post-metadata">

**Author:** ![malak03s](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@malak03s](https://forums.unrealengine.com/u/malak03s)\
**Post date:** [March 27, 2024, 2:33pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/3 "2024-03-27T14:33:16Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/4/f9457106075e57825406a4a3c3f1e24bee1327ca.png)

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

---

<div class="post-metadata">

**Author:** ![malak03s](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@malak03s](https://forums.unrealengine.com/u/malak03s)\
**Post date:** [March 27, 2024, 2:35pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/4 "2024-03-27T14:35:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [March 27, 2024, 2:38pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/5 "2024-03-27T14:38:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [March 27, 2024, 2:44pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/6 "2024-03-27T14:44:56Z")

</div>

Try:

 ![lerp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/1/8e14201937731a4832e4e2533f75d4b26e2307e4.png)

[M\_Outline\_occlusion\_v2.uasset](https://forums.unrealengine.com/uploads/short-url/zQrS0T75RU1QhqeHxz9XtQ5mBGA.uasset) (31.3 KB)

---

<div class="post-metadata">

**Author:** ![malak03s](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@malak03s](https://forums.unrealengine.com/u/malak03s)\
**Post date:** [March 27, 2024, 8:14pm UTC](https://forums.unrealengine.com/t/how-to-hide-post-process-outlines-when-object-is-occluded/1774595/7 "2024-03-27T20:14:59Z")

</div>

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