A method is described to construct modal fields for an arbitrary one- or two-dimensional refractive index structure. An arbitrary starting field is propagated along a complex axis using the slowly varying envelope approximation (SVEA). By choosing suitable values for the step-size, one mode is maximally increased in amplitude on propagating, until convergence has been obtained. For the calculation of the next mode, the mode just found is filtered out, and the procedure starts again. The method is tested for one-dimensional refractive index structures, both for nonabsorbing and for absorbing structures, and is shown to give fast convergence.