A Direct Solution of the Radiative Transfer Equation: Application to Atmospheric Models with Arbitrary Vertical Nonhomogeneities