Equations that describe the propagation of electromagnetic waves in three dimensionally inhomogeneous layers are obtained. Bending of rays, polarization rotation, diffraction, and volume Fresnel reflection are taken into account. The area of phenomena that cause deviations from the Rytov law is determined. The roles played by diffraction effects, quasi-rays, and quasi-ray tubes are discussed.