# Invisible Mesh that creates a shadow?

**URL:** <https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600>\
**Category:** Questions\
**Created:** [January 10, 2022, 5:27am UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600 "2022-01-10T05:27:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Kramling](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/andreas_kramling/32/13143_2.png) [@Andreas\_Kramling](https://forum.babylonjs.com/u/Andreas_Kramling)\
**Post date:** [January 10, 2022, 5:27am UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600/1 "2022-01-10T05:27:32Z")

</div>

Dear all,

is it possible to create a mesh that generates a shadow only but is actually not visible (only the shadow)?

Reasoning: I have many small meshes (\>1000) that are very closed to each other. If the shadow is calculates for each of these small objects, it slows down everything.  
Idea would be to have several (bigger) meshes that are not visible but generate the corresponding shadow.

Best  
Andreas

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [January 10, 2022, 11:29am UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600/2 "2022-01-10T11:29:05Z")

</div>

I can only assume there are other (and better) methods, but you could do something like this:

[Transparent objects casting soft transparent shadows | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#LKA8VM#20)

---

<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:** [January 10, 2022, 12:08pm UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600/3 "2022-01-10T12:08:44Z")

</div>

We can avoid using an observer by setting the `layerMask` property instead so that the cube is not drawn by the active camera:

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

If you want the invisible object to still occlude other objects, you can use set the `disableColorWrite` property of the material to `true` instead of `layerMask`:

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

---

<div class="post-metadata">

**Author:** ![Andreas\_Kramling](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/andreas_kramling/32/13143_2.png) [@Andreas\_Kramling](https://forum.babylonjs.com/u/Andreas_Kramling)\
**Post date:** [January 11, 2022, 7:06am UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600/4 "2022-01-11T07:06:28Z")

</div>

Many thanks Evgeni… I will try…

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 9, 2022, 3:23pm UTC](https://forum.babylonjs.com/t/invisible-mesh-that-creates-a-shadow/26600/5 "2022-02-09T15:23:41Z")

</div>

Hello @Andreas_Kramling just checking in, was your question answered? 🙂
