Cast shadow through mesh with alpha

This is related to Cast shadow through alpha masked mesh & customDepthMaterial However I’m not sure how to adapt this solution to a simple cube mesh? I’ve made a JS Fiddle here: ThreeJS casting shadows through mesh with alpha - JSFiddle - Code Playground What I’m looking for is a solution to allow the cube with the transparency to cast a less strong shadow. I’m not sure what to use for the alphaMap for the cube2.customDistanceMaterial.

Thank you!
ajp

I don’t think this is possible without massive effort.
The article is referring to alpha masked… which is either on or off, not actually changing the shadow intensity based on alpha.

Maybe with a custom WebGL shader … or with WebGPU webgpu_shadowmap_opacity?

1 Like

Yes maybe hard changes need. One solution is add second… direction light which will cast shadow only for yellow box and set directionalLight.shadow.intensity=0.1. Maybe i wrong.

2 Likes

I think it’s possible. I gave it a go but abandoned the effort. Couldn’t get the two different layers to render together. Thanks for your suggestion.