Any way to make a mesh cast shadow and be invisible?

Hi everyone!

Short question for weird science; is there any way to make a mesh invisible for the viewer but still keep it casting shadows?

Consider this example:
https://playground.babylonjs.com/#S7E00P#61

The box above the characters is casting a shadow, but would it be possible to make the box invisible while still casting shadows? The use case for this would be some dynamic shadows where I could turn room “lights” on/off by adding an obstacle above everything :slight_smile:

You can set the box layerMask to 0 … that will tell the camera not to render the box… but you will still have the shadow. Take a look at line 36 in this playground

https://playground.babylonjs.com/#S7E00P#64

3 Likes

Excellent, thank you!! :heart: