# Custom Depth Stencil for particle effects?

**URL:** <https://forums.unrealengine.com/t/custom-depth-stencil-for-particle-effects/255258>\
**Category:** FX\
**Tags:** unreal-engine\
**Created:** [October 11, 2021, 9:04am UTC](https://forums.unrealengine.com/t/custom-depth-stencil-for-particle-effects/255258 "2021-10-11T09:04:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Graylord](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Graylord](https://forums.unrealengine.com/u/Graylord)\
**Post date:** [October 11, 2021, 9:04am UTC](https://forums.unrealengine.com/t/custom-depth-stencil-for-particle-effects/255258/1 "2021-10-11T09:04:43Z")

</div>

Hey, so I have custom stencil channels for my objects and got it working fine, but I can’t seem to find any way to define stencils on particle effects?

I know you can set it if it’s placed or in a blueprint, but these are spawned at runtime.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [October 12, 2021, 1:41am UTC](https://forums.unrealengine.com/t/custom-depth-stencil-for-particle-effects/255258/2 "2021-10-12T01:41:12Z")

</div>

You would have to modify it before it is spawned.

Whatever reference of the particle effect is being passed in before you display it on screen _should_ have a BP method to enable you to change the stencil number.

As I recall, the stencil changes require you to set the mesh to dirty for them to actually be reflected. So it’s really only possible via C++.  
Maybe it’s changed since it’s been a year or so. And maybe it was just never that way for niagara since it’s newer.

What are you trying to do? Maybe custom stencil isn’t the best way?

---

<div class="post-metadata">

**Author:** ![Graylord](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Graylord](https://forums.unrealengine.com/u/Graylord)\
**Post date:** [October 13, 2021, 7:20pm UTC](https://forums.unrealengine.com/t/custom-depth-stencil-for-particle-effects/255258/3 "2021-10-13T19:20:51Z")

</div>

I have various outlines on various actors in my game, using stencils to seperate them for various effects in my post process material. However, one of my particle effects spawns on the destruction of an enemy, so it’s never actually placed. If it’s possible to do via C++ that should be viable though, as I do have a reference to the effect in question on spawn.
