How to recalc surface shadow?

Hi,

I’m playing with shaders modification of built-in material via onBeforeCompile and I have the following issue I can’t realize how to fix it - after object disappeared (diffuseColor.a = 0.0 or gl_FragColor.a = 0.0 in fragmentShader section) the shadow is still there on a surface where an object was… I don’t know how to force shadow recalculation in this case?

UPD This topiic was about InstancedMesh. And the only way I’ve found till now is set instancedMesh.count = 0 to remove shadows… So, the question is how to remove shadow through shader (or somehow) dynamically for InstancedMesh if I have dynamic control of alpha channel like this diffuseColor.a = sin(vTime); that making mesh disappear smoothly as well as appearence?

Unfortunately, you hit a restriction of the engine. three.js is currently (r118) not able to attenuate the shadow of transparent objects. More information in the following issue at GitHub:

Thanks for an answer, Michael! And there is no any solutions/tricks to do that with onBeforeRender may be ?

This needs to be fixed in the shader so onBeforeRender() does not really help here.