The refraction of starlight being done by the atmosphere causes the twinkling of a star. When starlight enters the earth’s atmosphere, it undergoes constant refraction before reaching the surface. Atmospheric refraction takes place in a material with a fluctuating refractive index.