# Partial invisible

**URL:** <https://forum.babylonjs.com/t/partial-invisible/39154>\
**Category:** Questions\
**Created:** [March 18, 2023, 6:43am UTC](https://forum.babylonjs.com/t/partial-invisible/39154 "2023-03-18T06:43:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://forum.babylonjs.com/u/czx)\
**Post date:** [March 18, 2023, 6:43am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/1 "2023-03-18T06:43:54Z")

</div>

an object for example, a cube, moves from the left to the right, until it reaches a plane vertical to its moving direction. how to make the part which crosses the plane be invisible but leaving the other part visible? is there any related api?

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [March 18, 2023, 6:47am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/2 "2023-03-18T06:47:21Z")

</div>

It sounds like clipping planes are what you seek: [Using Clipping Planes | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/scene/clipPlanes)

---

<div class="post-metadata">

**Author:** ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://forum.babylonjs.com/u/czx)\
**Post date:** [March 18, 2023, 6:53am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/3 "2023-03-18T06:53:49Z")

</div>

it may solve my problem. thank you very much @inteja .

---

<div class="post-metadata">

**Author:** ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://forum.babylonjs.com/u/czx)\
**Post date:** [March 18, 2023, 8:28am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/4 "2023-03-18T08:28:07Z")

</div>

@inteja it doesn’t work. All objects divided by the clip plane will be invisible. what I wanted is that only the specific object will be partially visible and partially invisible, leaving all other background objects untouched. Does any one can help?

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [March 18, 2023, 8:43am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/5 "2023-03-18T08:43:30Z")

</div>

That linked documentation page explains exactly how to do this with an example - “[Clipping Planes Example 2](https://playground.babylonjs.com/#EHLHNX)”. Note that the sphere is clipped but the ground plane is not.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [March 18, 2023, 8:57am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/6 "2023-03-18T08:57:36Z")

</div>

Not sure what your issue with the answer above is? May be you don’t want to clip it with a plane, but rather some other mesh?  
I guess the above is the simplest and most recommendable but if you need some other object to act as a mask there are still other solutions (including this small hack below). You could also use renderingGroupID or work it through a material/shader.  
Not sure if I can really recommend the simple hack below (based on the rendering order and depth of alpha blended and opaque meshes) but I guess it could do the trick depending on your use case:

> **[Babylon.js Playground](https://playground.babylonjs.com/#3MCNDT)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Edit: Oh, and I nearly forgot, Welcome to our Community and … have a great day 🕶

Edit1: Here’s quickly a derivative of the above small ‘hack’ 😁. Still a hack but a little more recommendable. Using a texture and setting the texture as alpha will make the rendering go through the alpha test. Less likely to create bugs or artefacts.

> **[Babylon.js Playground](https://playground.babylonjs.com/#3MCNDT%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 18, 2023, 11:55am UTC](https://forum.babylonjs.com/t/partial-invisible/39154/7 "2023-03-18T11:55:15Z")

</div>

Note that since 5.0 you can define the clip planes through the material:

> <https://github.com/BabylonJS/Documentation/pull/797>

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [March 18, 2023, 11:11pm UTC](https://forum.babylonjs.com/t/partial-invisible/39154/8 "2023-03-18T23:11:56Z")

</div>

Thanks @Evgeni_Popov! I didn’t know this.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 20, 2023, 3:34pm UTC](https://forum.babylonjs.com/t/partial-invisible/39154/9 "2023-03-20T15:34:20Z")

</div>

And I did not remember it lol
