# Is it possible to have 16-bit stencils instead of 8-bit?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-have-16-bit-stencils-instead-of-8-bit/473979>\
**Category:** Rendering\
**Tags:** stencil, unreal-engine, Rendering, CPP, question\
**Created:** [November 4, 2020, 6:34am UTC](https://forums.unrealengine.com/t/is-it-possible-to-have-16-bit-stencils-instead-of-8-bit/473979 "2020-11-04T06:34:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinayaka\_P](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vinayaka\_P](https://forums.unrealengine.com/u/Vinayaka_P)\
**Post date:** [November 4, 2020, 6:34am UTC](https://forums.unrealengine.com/t/is-it-possible-to-have-16-bit-stencils-instead-of-8-bit/473979/1 "2020-11-04T06:34:22Z")

</div>

Hi,  
I have more than 256 meshes in level and I want to assign a unique stencil for each mesh. See images, UE4 caps max value to 255, I know stencil value is of type **uint8**.

Is there any work around to achieve 16-bit stencil??

---

<div class="post-metadata">

**Author:** ![Doudinvillier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Doudinvillier](https://forums.unrealengine.com/u/Doudinvillier)\
**Post date:** [September 27, 2024, 9:59am UTC](https://forums.unrealengine.com/t/is-it-possible-to-have-16-bit-stencils-instead-of-8-bit/473979/2 "2024-09-27T09:59:57Z")

</div>

Hey! Have you found a way to avoid the 256 limitation?

---

<div class="post-metadata">

**Author:** ![EliasWick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eliaswick/32/1175208_2.png) [@EliasWick](https://forums.unrealengine.com/u/EliasWick)\
**Post date:** [September 28, 2024, 12:42pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-have-16-bit-stencils-instead-of-8-bit/473979/3 "2024-09-28T12:42:38Z")

</div>

This is not a solution but a suggestion: You can update the C++ rendering code to increase this value. It might make the stencil buffer much heavier though.

I have an issue seeing why someone would need more than the 256 stencils. I think a shader solution is possible to achieve more results, but I would need to know more information.
