Diffractive optical
elements (DOEs) are widely applied as compact
solutions to generate desired optical patterns in the far field by
wavefront shaping. They consist of microscopic structures of varying
heights to control the phase of either reflected or transmitted light.
However, traditional methods to achieve varying thicknesses of structures
for DOEs are tedious, requiring multiple aligned lithographic steps
each followed by an etching process. Additionally, the reliance on
photomasks precludes rapid prototyping and customization in manufacturing
complex and multifunctional surface profiles. To achieve this, we
turn to nanoscale 3D printing based on two-photon polymerization lithography
(TPL). However, TPL systems lack the precision to pattern diffractive
components where subwavelength variations in height and position could
lead to observable loss in diffraction efficiency. Here, we employed
a lumped TPL parametric model and a workaround patterning strategy
to achieve precise 3D printing of DOEs using optimized parameters
for laser power, beam scan speed, hatching distance, and slicing distance.
In our case study, millimeter scale near-perfect Dammann gratings
were fabricated with measured diffraction efficiencies near theoretical
limits, laser spot array nonuniformity as low as 1.4%, and power ratio
of the zero-order spot as low as 0.4%. Leveraging on the advantages
of additive manufacturing inherent to TPL, the 3D-printed optical
devices can be applied for precise wavefront shaping, with great potential
in all-optical machine learning, virtual reality, motion sensing,
and medical imaging.