# Stencil buffer exceeded, clipping will not work as expected

**URL:** <https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026>\
**Category:** Questions\
**Created:** [May 4, 2020, 10:57am UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026 "2020-05-04T10:57:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![russelkgd](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/russelkgd/32/15767_2.png) [@russelkgd](https://forum.defold.com/u/russelkgd)\
**Post date:** [May 4, 2020, 10:57am UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026/1 "2020-05-04T10:57:46Z")

</div>

Hi everyone, i have a quick question.

I have dynamically loaded nodes with stencil on them, and everything was fine until the number of nodes was below some number (15 for me). When 16th node was draw, i receive this warning: “Stencil buffer exceeded, clipping will not work as expected” and clipping become weird.

So if there is a way to increase the size of the stencil buffer or i have to find a workaround?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [May 4, 2020, 11:10am UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026/2 "2020-05-04T11:10:25Z")

</div>

> [@russelkgd](#):
>
> So if there is a way to increase the size of the stencil buffer or i have to find a workaround?

I think you need to find a workaround I’m afraid.

---

<div class="post-metadata">

**Author:** ![russelkgd](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/russelkgd/32/15767_2.png) [@russelkgd](https://forum.defold.com/u/russelkgd)\
**Post date:** [May 4, 2020, 11:20am UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026/3 "2020-05-04T11:20:10Z")

</div>

No problem, i have already one in mind

---

<div class="post-metadata">

**Author:** ![morgerion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/morgerion/32/6641_2.png) [@morgerion](https://forum.defold.com/u/morgerion)\
**Post date:** [August 3, 2020, 10:47am UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026/4 "2020-08-03T10:47:30Z")

</div>

We faced with same problem.  
Defold uses the full stencil or is it possible to use scissors test?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [August 3, 2020, 1:12pm UTC](https://forum.defold.com/t/stencil-buffer-exceeded-clipping-will-not-work-as-expected/65026/5 "2020-08-03T13:12:29Z")

</div>

We use stencil buffer for this.  
Not that this is for the clipping logic between the gui nodes, and there are are some [upper limits](https://defold.com/manuals/gui-clipping/#stencil-limitations).
