Clear shadow at runtime

Trying to manually “enable/disable” shadow at runtime. There’s an answer here which I’ve followed and was able to disable auto updating for shadow, but unable to clear already existed shadow.

this.renderer.shadowMap.autoUpdate = false;
this.renderer.clearTarget(this.dirLight.shadowMap); // might be this code is incorrect

BTW I’m using EffectComposer with a RenderPass instead of using renderer.render() directly.

Thanks for reading, any advice? :slight_smile:

Solved the problem by changing

this.renderer.clearTarget(this.dirLight.shadowMap);

into

this.renderer.clearTarget(this.dirLight.shadow.map);

:grin:

2 Likes