This material implements a shadowmatte shader that occludes geometry behind the surface being rendered. The output image, however, will have the alpha value specified.
The output color is always zero.
The material is used in many compositing tricks. Where the surface is shadowed, the alpha of the output image will contain additional alpha. When the resulting image is composited over a background plate, the shadowed regions will occlude the background plate, simulating shadows.
When the shadowmatte shader is hit by shadow rays, the shadow amount determines how much of a shadow will be cast by the surface, meaning that both the opacity and alpha outputs will inherit the shadow amount. When the shader is not hit by shadow rays, the alpha output is computed using an illuminance loop that ignores the shadow amount, while the opacity is set to 1.