Atmospheric refraction is the deviation of light as it passes through the atmosphere due to changes in air density with altitude. This causes several optical phenomena including mirages and the apparent shimmering or rippling of distant objects. It also results in the sun appearing before actual sunrise and after actual sunset due to light bending as it passes through changing air densities in the atmosphere. Stars appear to twinkle due to their light continuously refracting as it passes through atmospheric layers of changing density, while planets do not twinkle as much due to their larger apparent size. The sun also appears larger during sunrise and sunset compared to noon due to greater refraction of light through more dense lower atmosphere.