We study the interaction of a mode propagating in a planar waveguide with a three dimensional rectangular defect (protrusion or notch) in the structure. The scattering by the defect disturbes the propagation of the mode and light is coupled out of the waveguide. To investigate these phenomena we compute electric field distributions with the Green's tensor technique and show movies with varying defect geometries and different mode polarizations. These calculations should be useful for optimizing specific elements in complex photonic circuits. (C) 2001 Optical Society of America.