We present a three-dimensional (3D) technique for computing light scattering and propagation in complex structures formed by scatterers embedded in a stratified background. This approach relies on the Green's tensor associated with the background and requires only the discretization of the scatterers, the entire stratified background being accounted for in the Green's tensor. Further, the boundary conditions at the edges of the computation window and at the different material interfaces in the stratified background are automatically fulfilled. Different examples illustrate the application of the technique to the modeling of photonic integrated circuits: waveguides with protrusions (single element 'grating') and notches. Subtle effects, like polarization crosstalks in an integrated optics device are also investigated.