We generalize the optical treatment of X-ray waveguides to index profiles of arbitrary shape. The modes of the waveguides are computed numerically by Numerov’s method. The method is first validated by considering profiles for which analytical solutions exist. Next, the effects of different shape functions and of interfacial roughness on the near and far-field intensity distributions are studied. The results are helpful to judge the real structure effects, e.g. resulting from fabrication imperfections, on the optical performance, as well as to optimize optical properties by designing generalized index profiles.