Green function for multilayers: Light scattering in planar cavities | Synapse