How to change the shadows generated from a dissolve?

You need to provide your own shadow material to the shadow generator to account for the specificities of your custom material:

https://www.babylonjs-playground.com/#I669IL#6

I have simply copied the standard shadow map vertex and fragment shaders used by the shadow generator and added the check to discard the fragment based on the noise value.

It’s a bit complicated, maybe we should think of a better way to handle this…

Note that I have disabled back face culling on the sphere, as it’s probably what you want for the shadow to be correct.

You can get some more info here: Mesh with custom shader material does not cast shadow

1 Like