Boundary conditions for light going through different media