Atmospheric refraction is the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height.[ This refraction is due to the velocity of light through air, decreasing (the refractive index increases) with increased density. Atmospheric refraction near the ground produces mirages. Such refraction can also raise or lower, or stretch or shorten, the images of distant objects without involving mirages. Turbulent air can make distant objects appear to twinkle or shimmer. The term also applies to the refraction of sound. Atmospheric refraction is considered in measuring the position of both celestial and terrestrial objects. Astronomical or celestial refraction causes astronomical objects to appear higher above the horizon than they actually are. Terrestrial refraction usually causes terrestrial objects to appear higher than they actually are, although in the afternoon when the air near the ground is heated, the rays can curve upward making objects appear lower than they actually are.