With the "Shadow to Opacity" SpatialMaterial flag set, the opacity is multiplied by the ambient light color and energy. Shadows are only opaque if illuminated by ambient light. In a scene with less/no ambient light, the shadowed areas are translucent or invisible.
Is that how it is intended to work?
I got pretty much what I wanted with a very short shader, anyway:
shader_type spatial;
void light() {
DIFFUSE_LIGHT = vec3(0.0);
ALPHA = 1.0 - ATTENUATION.z;
}