While trying to get partially visible meshes to render correctly, I’ve found setting needDepthPrePass to true fixes issues with occluded mesh faces rendering on top. However I found that setting needDepthPrePass to true stops shadows from being generated for that mesh, but only if the visibility of the mesh is set to 1. If visibility is set to less than 1 (and the shadow generator is setup for transparent shadows) they still cast.
Example playground of a mesh jumping between 1 and .9999 visibility with needDepthPrePass set to true Babylon.js Playground
Is there something I’m not understanding with how needDepthPrePass and shadow generators interact or is this a bug? Any good workaround for this, other than rendering a mesh at .9999 visibility, since I imagine doing that has a bigger performance impact?