# Custom stencil filtering for DBuffer decals

**URL:** <https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974>\
**Category:** Rendering\
**Tags:** stencil, unreal-engine, Decals, question\
**Created:** [June 23, 2018, 2:33pm UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974 "2018-06-23T14:33:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vvoz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vvoz](https://forums.unrealengine.com/u/Vvoz)\
**Post date:** [June 23, 2018, 2:33pm UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974/1 "2018-06-23T14:33:21Z")

</div>

What I want is to have a decal that ignores certain meshes. Turning off “receive decals” is not an option, since I want these meshes to be affected by other decals. So instead I enabled custom stencil and used it like this:

 ![245172-png-image-588641-pixels.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/2/0b28957daac8691ee56e50cec57db8007b04983f.png)

And that worked perfectly fine with translucent blend mode. However when i changed blend mode to dbuffer, so the decal would work correctly with lighting, my custom stencil node only returns zeroes and completely ignores actual stencil value.  
Is it supposed to be like that or what am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Mr\_Panceto](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mr_panceto/32/775837_2.png) [@Mr\_Panceto](https://forums.unrealengine.com/u/Mr_Panceto)\
**Post date:** [June 26, 2018, 5:28pm UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974/2 "2018-06-26T17:28:20Z")

</div>

I have the same problem. Anyone knows something about this?

---

<div class="post-metadata">

**Author:** ![BlackBeastie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackBeastie](https://forums.unrealengine.com/u/BlackBeastie)\
**Post date:** [July 27, 2018, 6:48am UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974/3 "2018-07-27T06:48:33Z")

</div>

My team have encountered this problem too. Anybody knows how to solve it?

---

<div class="post-metadata">

**Author:** ![MrBlastark](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrBlastark](https://forums.unrealengine.com/u/MrBlastark)\
**Post date:** [July 27, 2018, 11:29am UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974/4 "2018-07-27T11:29:12Z")

</div>

You must add a string r.customdepth.order=0 in DefaultEngine.ini

---

<div class="post-metadata">

**Author:** ![Spaehling](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/spaehling/32/251678_2.png) [@Spaehling](https://forums.unrealengine.com/u/Spaehling)\
**Post date:** [October 22, 2019, 2:24pm UTC](https://forums.unrealengine.com/t/custom-stencil-filtering-for-dbuffer-decals/427974/5 "2019-10-22T14:24:03Z")

</div>

Hey i allready posted in another topic, but it should be here aswell. just in case.

i also ran into the issue and there is one more important setting you need to setup.

Go to project settings and change Custom Depth Stencil Pass to: EnabledWithStencil and then RESTART the editor (that is important too).
