Thanks for the reply, I didn’t know about this node. But unfortunately, it doesn’t work.
I create procedural surfaces based on ray marching inside meshes. I think the generated Opacity mask should work for shadows as well, but it doesn’t for static shadows.