# Only render part of custom depth buffer based on overlap

**URL:** <https://forums.unrealengine.com/t/only-render-part-of-custom-depth-buffer-based-on-overlap/368381>\
**Category:** Rendering\
**Tags:** buffer, custom-depth, unreal-engine, Rendering, Shaders, question\
**Created:** [August 26, 2016, 7:39pm UTC](https://forums.unrealengine.com/t/only-render-part-of-custom-depth-buffer-based-on-overlap/368381 "2016-08-26T19:39:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Araklaj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Araklaj](https://forums.unrealengine.com/u/Araklaj)\
**Post date:** [August 26, 2016, 7:39pm UTC](https://forums.unrealengine.com/t/only-render-part-of-custom-depth-buffer-based-on-overlap/368381/1 "2016-08-26T19:39:44Z")

</div>

Hi guys!

We’re trying to achieve a kind of radar which only shows certain meshes behind it, like this:

[https://i.sli.mg/ZiAyYR.png](https://i.sli.mg/ZiAyYR.png)

The issue is, the radar’s “red area” is not static but dynamic, wobbling in front of player. So we need to either make the radar only render certain objects in xray vision, or save them to custom depth buffer and create a mask dynamically from the radar’s shape. Either mesh or UMG.

The first picture in this link, the “Filter all except stencil 1” is exactly what we’re after - only show parts of a certain mesh while within a certain area. But there’s no info on how that specific effect is achieved, we checked the source, there’s only non-local xray setup which makes objects visible through any wall, we want them visible only through one single mesh/UMG that player has as part of UI.

Any ideas on what we can do?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_48f2118e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_48f2118e](https://forums.unrealengine.com/u/anonymous_user_48f2118e)\
**Post date:** [August 26, 2016, 7:45pm UTC](https://forums.unrealengine.com/t/only-render-part-of-custom-depth-buffer-based-on-overlap/368381/2 "2016-08-26T19:45:41Z")

</div>

Perhaps buying this plugin and examining how it works would help: [Outliner in Materials - UE Marketplace](https://www.unrealengine.com/marketplace/outliner)

I am not affiliated with the plugin or its author, but I have purchased it and used it before.

---

<div class="post-metadata">

**Author:** ![Araklaj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Araklaj](https://forums.unrealengine.com/u/Araklaj)\
**Post date:** [August 26, 2016, 9:01pm UTC](https://forums.unrealengine.com/t/only-render-part-of-custom-depth-buffer-based-on-overlap/368381/3 "2016-08-26T21:01:14Z")

</div>

Thanks for the suggestion! We can do all that already, but not make the outline appear only when the object is behind one specific mesh, but not others.
