Radiative equilibrium in the outer layers of a star