Invisible Mesh that creates a shadow?

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

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)

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

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:

3 Likes

Many thanks Evgeni… I will try…

1 Like

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