Nonlinear optical response in patterned planar waveguides