An optical apparatus comprising: a waveguide provided with first and second diffractive element sets, the waveguide configured to substantially confine in at least one transverse dimension optical fields propagating therein, wherein: the first diffractive element set is configured to diffract an optical field propagating from a first entrance optical port of the waveguide to an optical field propagating to a first exit optical port of the waveguide; the second diffractive element set is configured to diffract an optical field propagating from a second entrance optical port of the waveguide to an optical field propagating to a second exit optical port of the waveguide; the first and second diffractive element sets are at least partially spatially overlapped; each of the first and second diffractive elements sets includes a plurality of diffractive elements; each diffractive element is for controlling the amplitude and phase of the optical fields propagating in the waveguide, and has a corresponding diffractive element transfer function defining the diffracted component of an incident optical field; the diffractive element transfer functions of the first diffractive element set superpose to provide a first overall transfer function between the first entrance optical port and the corresponding first exit optical port; the diffractive element transfer functions of the second diffractive element set superpose to provide a second overall transfer function between the second entrance optical port and the corresponding second exit optical port; each diffractive element being spatially defined by a corresponding curvilinear contour and comprising a plurality of curvilinear diffracting segments, each having an optical property so as to enable diffraction of a portion of the incident optical field therefrom; at least one diffractive element transfer function is determined at least in part by variation of the spatial profile of the optical property of the diffracting segments; at least some of the corresponding curvilinear contours are intersecting contours; the curvilinear diffracting segments on intersecting contours are arranged so that the curvilinear diffracting segments do not intersect. the first diffractive element set is configured to diffract an optical field propagating from a first entrance optical port of the waveguide to an optical field propagating to a first exit optical port of the waveguide; the second diffractive element set is configured to diffract an optical field propagating from a second entrance optical port of the waveguide to an optical field propagating to a second exit optical port of the waveguide; the first and second diffractive element sets are at least partially spatially overlapped; each of the first and second diffractive elements sets includes a plurality of diffractive elements; each diffractive element is for controlling the amplitude and phase of the optical fields propagating in the waveguide, and has a corresponding diffractive element transfer function defining the diffracted component of an incident optical field; the diffractive element transfer functions of the first diffractive element set superpose to provide a first overall transfer function between the first entrance optical port and the corresponding first exit optical port; the diffractive element transfer functions of the second diffractive element set superpose to provide a second overall transfer function between the second entrance optical port and the corresponding second exit optical port; each diffractive element being spatially defined by a corresponding curvilinear contour and comprising a plurality of curvilinear diffracting segments, each having an optical property so as to enable diffraction of a portion of the incident optical field therefrom; at least one diffractive element transfer function is determined at least in part by variation of the spatial profile of the optical property of the diffracting segments; at least some of the corresponding curvilinear contours are intersecting contours; the curvilinear diffracting segments on intersecting contours are arranged so that the curvilinear diffracting segments do not intersect.