What causes refraction to occur?