# \#stencil-buffer

**URL:** https://discourse.threejs.org/tag/stencil-buffer/82.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Reflector and pass node are ignoring the stencil buffer in WebGPU](https://discourse.threejs.org/t/reflector-and-pass-node-are-ignoring-the-stencil-buffer-in-webgpu/86557)

<div class="topic-metadata">

**Author:** [@Gnan\_Sai](https://discourse.threejs.org/u/Gnan_Sai)\
**Replies:** 1\
**Last updated:** [August 27, 2025, 9:38am UTC](https://discourse.threejs.org/t/reflector-and-pass-node-are-ignoring-the-stencil-buffer-in-webgpu/86557 "2025-08-27T09:38:54Z")

</div>

reflector and pass node are ignoring the stencil buffer. Is there any work around for this? Thank you Live examples jsfiddle-latest-release WebGPURenderer - stencilbuffer with reflector jsfiddle-latest-release WebGP…

---

## [Stencil buffer - how to make a mesh to be visible through another mesh only?](https://discourse.threejs.org/t/stencil-buffer-how-to-make-a-mesh-to-be-visible-through-another-mesh-only/83484)

<div class="topic-metadata">

**Author:** [@GUESTJS](https://discourse.threejs.org/u/GUESTJS)\
**Replies:** 6\
**Last updated:** [June 8, 2025, 10:13am UTC](https://discourse.threejs.org/t/stencil-buffer-how-to-make-a-mesh-to-be-visible-through-another-mesh-only/83484 "2025-06-08T10:13:40Z")

</div>

Ive tried many different options but still can’t understand why the red plane is visible always while i want it to be visible through green planes only. const renderer = new THREE.WebGLRenderer({ antialias: false, p…

---

## [Three JS equivalent operation to BlitFramebuffer](https://discourse.threejs.org/t/three-js-equivalent-operation-to-blitframebuffer/52197)

<div class="topic-metadata">

**Author:** [@AEspinosaDev](https://discourse.threejs.org/u/AEspinosaDev)\
**Replies:** 6\
**Last updated:** [July 31, 2024, 6:51am UTC](https://discourse.threejs.org/t/three-js-equivalent-operation-to-blitframebuffer/52197 "2024-07-31T06:51:49Z")

</div>

Hi guys, I need to do a simple operation in my application, very common in certain techniques, but for some reason I can’t find how to do it in the Three Js framework. The operation is basically render to a certain ren…

---

## [How to use a stencil buffer](https://discourse.threejs.org/t/how-to-use-a-stencil-buffer/13211)

<div class="topic-metadata">

**Author:** [@Anatoliy\_Churikov](https://discourse.threejs.org/u/Anatoliy_Churikov)\
**Replies:** 8\
**Last updated:** [February 4, 2024, 4:01am UTC](https://discourse.threejs.org/t/how-to-use-a-stencil-buffer/13211 "2024-02-04T04:01:28Z")

</div>

Hi. Can someone help me with my issue? I am trying to use the stencil buffer in three.js, but the examples I found do not explain how to do this step by step. My question: https://stackoverflow.com/questions/60129665/us…

---

## [Multiple stencil operations, do I use \`.renderOrder\` with two objects or multiple calls to \`renderer.render()\`?](https://discourse.threejs.org/t/multiple-stencil-operations-do-i-use-renderorder-with-two-objects-or-multiple-calls-to-renderer-render/57413)

<div class="topic-metadata">

**Author:** [@atwk](https://discourse.threejs.org/u/atwk)\
**Replies:** 0\
**Last updated:** [October 25, 2023, 9:08pm UTC](https://discourse.threejs.org/t/multiple-stencil-operations-do-i-use-renderorder-with-two-objects-or-multiple-calls-to-renderer-render/57413 "2023-10-25T21:08:02Z")

</div>

I have to set the stencil buffer independently 2 different ways for rendering some objects, but the object setting the stencil is the same for both methods. In my case, I have a volume that stencils out the current view …

---

## [Capping clipped planes using stencil on a BufferGeometry()](https://discourse.threejs.org/t/capping-clipped-planes-using-stencil-on-a-buffergeometry/18407)

<div class="topic-metadata">

**Author:** [@rahul.pillai93](https://discourse.threejs.org/u/rahul.pillai93)\
**Replies:** 46\
**Last updated:** [July 20, 2023, 10:30am UTC](https://discourse.threejs.org/t/capping-clipped-planes-using-stencil-on-a-buffergeometry/18407 "2023-07-20T10:30:08Z")

</div>

Hi. I am a bit of a novice when it comes to coding on three.js so I wanted some help on this: I am working on a project that requires clipping planes on a geometry and then capping up the cut portion. I saw many example…

---

## [Visually close InstancedMesh clipped by clipping plane](https://discourse.threejs.org/t/visually-close-instancedmesh-clipped-by-clipping-plane/40600)

<div class="topic-metadata">

**Author:** [@Quinten](https://discourse.threejs.org/u/Quinten)\
**Replies:** 0\
**Last updated:** [July 21, 2022, 7:35pm UTC](https://discourse.threejs.org/t/visually-close-instancedmesh-clipped-by-clipping-plane/40600 "2022-07-21T19:35:55Z")

</div>

I want to have spheres inside a box made of clipping planes. The camera looks into the box from the outside. The box has periodic boundary conditions (a 3 torus geometry), thus spheres get clipped a lot. To model the s…

---

## [How can I place a GLTF model behind a stencil mask in three.js?](https://discourse.threejs.org/t/how-can-i-place-a-gltf-model-behind-a-stencil-mask-in-three-js/34030)

<div class="topic-metadata">

**Author:** [@Jon\_A](https://discourse.threejs.org/u/Jon_A)\
**Replies:** 2\
**Last updated:** [April 19, 2022, 5:38pm UTC](https://discourse.threejs.org/t/how-can-i-place-a-gltf-model-behind-a-stencil-mask-in-three-js/34030 "2022-04-19T17:38:34Z")

</div>

I’m using a stencil mask in Three.js to create a portal effect. It works correctly on meshes when I can control the material. However, when I load a gltf model with the model’s material I cannot get it to hide outside th…

---

## [How to render caps like webgl\_clipping\_stencil?](https://discourse.threejs.org/t/how-to-render-caps-like-webgl-clipping-stencil/36727)

<div class="topic-metadata">

**Author:** [@Fraserr\_01](https://discourse.threejs.org/u/Fraserr_01)\
**Replies:** 0\
**Last updated:** [April 4, 2022, 2:56pm UTC](https://discourse.threejs.org/t/how-to-render-caps-like-webgl-clipping-stencil/36727 "2022-04-04T14:56:22Z")

</div>

Hi. I’m new to THREE and discourse.threejs. I’m trying to clip and cap threejs objects that have been rendered so I can move the helperPlane back and forth through the object to see inside it. There might be rendered obj…

---

## [What could cause the stencil func to flip?](https://discourse.threejs.org/t/what-could-cause-the-stencil-func-to-flip/30439)

<div class="topic-metadata">

**Author:** [@schwyzl](https://discourse.threejs.org/u/schwyzl)\
**Replies:** 1\
**Last updated:** [October 1, 2021, 9:20am UTC](https://discourse.threejs.org/t/what-could-cause-the-stencil-func-to-flip/30439 "2021-10-01T09:20:01Z")

</div>

I’m using clipping and stencilling to slice a model. This is the model for context: This is the model after slicing… So far so good. My issue is that the stencil func seems to flip based on the camera position. F…

---

## [How to get StencilBuffer into a texture?](https://discourse.threejs.org/t/how-to-get-stencilbuffer-into-a-texture/23780)

<div class="topic-metadata">

**Author:** [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Replies:** 3\
**Last updated:** [March 19, 2021, 2:27am UTC](https://discourse.threejs.org/t/how-to-get-stencilbuffer-into-a-texture/23780 "2021-03-19T02:27:28Z")

</div>

I need to get the silhouette of a mesh into a texture. Can I use a stencil buffer for this? I’ve used a WebGLRenderTarget to extract the depth texture from my scene in the past, and I was wondering if the same was possi…

---

## [Does WebGL.Stencil work in Three.js/editor?](https://discourse.threejs.org/t/does-webgl-stencil-work-in-three-js-editor/24121)

<div class="topic-metadata">

**Author:** [@shikitos](https://discourse.threejs.org/u/shikitos)\
**Replies:** 0\
**Last updated:** [March 6, 2021, 9:32am UTC](https://discourse.threejs.org/t/does-webgl-stencil-work-in-three-js-editor/24121 "2021-03-06T09:32:53Z")

</div>

I’m trying to create a scene with a portal in the three editor.js, but I can’t do it. I have a suspicion of a problem with WebGL, namely with Stencil. Is Stencil supported in the editor, or could the problem be in anothe…

---

## [How to remove a part of a mesh with clipping planes?](https://discourse.threejs.org/t/how-to-remove-a-part-of-a-mesh-with-clipping-planes/23718)

<div class="topic-metadata">

**Author:** [@ibrahimunal](https://discourse.threejs.org/u/ibrahimunal)\
**Replies:** 2\
**Last updated:** [February 22, 2021, 2:44pm UTC](https://discourse.threejs.org/t/how-to-remove-a-part-of-a-mesh-with-clipping-planes/23718 "2021-02-22T14:44:18Z")

</div>

As shown in the example. clipping planes only make it invisible as the plane pass through it. However is it possible to temporarly remove the part of the mesh as the planes go through x , y and z axises? What I mean by t…

---

## [Portal rendering with stencil buffer](https://discourse.threejs.org/t/portal-rendering-with-stencil-buffer/22425)

<div class="topic-metadata">

**Author:** [@BarthaBRW](https://discourse.threejs.org/u/BarthaBRW)\
**Replies:** 5\
**Last updated:** [January 24, 2021, 8:37pm UTC](https://discourse.threejs.org/t/portal-rendering-with-stencil-buffer/22425 "2021-01-24T20:37:19Z")

</div>

Hi everyone, I made an experiment with stencil buffer to create an infinite room with portals back in September. As I’ve just moved the private gitlab repo to github, I’d like to share it with you if there is anyone who…

---

## [Clipping Stencil](https://discourse.threejs.org/t/clipping-stencil/22113)

<div class="topic-metadata">

**Author:** [@geomNLP](https://discourse.threejs.org/u/geomNLP)\
**Replies:** 5\
**Last updated:** [January 8, 2021, 6:40am UTC](https://discourse.threejs.org/t/clipping-stencil/22113 "2021-01-08T06:40:55Z")

</div>

Does clipping stencil work with Effect composer renderer?

---

## [Stencil does not work on STL model](https://discourse.threejs.org/t/stencil-does-not-work-on-stl-model/21764)

<div class="topic-metadata">

**Author:** [@ibrahimunal](https://discourse.threejs.org/u/ibrahimunal)\
**Replies:** 6\
**Last updated:** [December 28, 2020, 9:23pm UTC](https://discourse.threejs.org/t/stencil-does-not-work-on-stl-model/21764 "2020-12-28T21:23:08Z")

</div>

Hello everyone, i’m trying to scrape my stl model thorugh x ,y and z planes.There is an example on example which demonstrates perfectly. As I check for the source code there is a line that initializes the model and send…

---

## [Fill a mesh with solid materials](https://discourse.threejs.org/t/fill-a-mesh-with-solid-materials/6488)

<div class="topic-metadata">

**Author:** [@tonifds](https://discourse.threejs.org/u/tonifds)\
**Replies:** 5\
**Last updated:** [March 16, 2019, 10:49am UTC](https://discourse.threejs.org/t/fill-a-mesh-with-solid-materials/6488 "2019-03-16T10:49:37Z")

</div>

how i can fill a mesh with solid materials, for example the inside of an STL file?

---

## [Stencil Buffer Threejs](https://discourse.threejs.org/t/stencil-buffer-threejs/4754)

<div class="topic-metadata">

**Author:** [@Prodigy](https://discourse.threejs.org/u/Prodigy)\
**Replies:** 3\
**Last updated:** [November 1, 2018, 6:56am UTC](https://discourse.threejs.org/t/stencil-buffer-threejs/4754 "2018-11-01T06:56:56Z")

</div>

How can I get the stencil buffer in threejs?

---

## [\[SOLVED\] Outlining a partially transparent 3D model](https://discourse.threejs.org/t/solved-outlining-a-partially-transparent-3d-model/284)

<div class="topic-metadata">

**Author:** [@Milun](https://discourse.threejs.org/u/Milun)\
**Replies:** 0\
**Last updated:** [May 2, 2017, 12:48am UTC](https://discourse.threejs.org/t/solved-outlining-a-partially-transparent-3d-model/284 "2017-05-02T00:48:07Z")

</div>

Hello, I'm trying to do a simple "click and select" 3D model viewer, but I've run into a snag. The current model I'm using looks like this: \[image\] If I use my current outline shader on the hopper, it shows through…
