I'm facing an issue where casting shadows through transparent parts of my Mesh using the MeshDepthMaterial
causes the shadows of animated objects to stop moving along with the animation.
You can see an example of this problem here: https://jsfiddle.net/miger/kj8gwue5/
var customDepthMaterial = new THREE.MeshDepthMaterial( {
depthPacking: THREE.RGBADepthPacking,
alphaMap: alphaTex,
alphaTest: 0.5
})
child.customDepthMaterial = customDepthMaterial;
If I remove the customDepthMaterial
input, you can observe that the shadow follows the animation properly in this example here. However, in doing so, the shadow no longer passes through the transparent part of the mesh, which is not the desired effect.
I have tried updating the depth material with needsUpdate
, but it did not solve the issue.
Is there a way to make the shadows work correctly with animations while using the depth material?