We present an approach for a fast and accurate determination of the geometrical optics solutions to Maxwell's equations based on the determination of the eikonal function and devised to handle scenarios involving complex spatially varying refraction indices. The explicit solution of the eikonal equation allows to set up an inverse ray tracing scheme, which proves particularly convenient compared to direct ray tracing. The field amplitude and polarization are then found by solving the relative transport equations along each ray. The accuracy of the method is shown in the case of the scattering from a conducting sphere coated by a dielectric.