  Graded-index optical elements are capable of shaping light precisely and in
very specific ways. While classical freeform optics uses only a two-dimensional
domain such as the surface of a lens, recent technological advances in laser
manufacturing offer promising prospects for the realization of arbitrary
three-dimensional graded-index volumes, i.e. transparent dielectric substrates
with voxel-wise modified refractive index distributions. Such elements would be
able to perform complex light transformations on compact scales. Here we
present an algorithmic approach for computing 3D graded-index devices, which
utilizes numerical beam propagation and error reduction based on gradient
descent. We present solutions for millimeter-sized elements addressing
important tasks in photonics: a mode sorter, a photonic lantern and a multimode
intensity beam shaper. We further discuss suitable cost functions for all
designs to be used in the algorithm. The 3D graded-index designs are spatially
smooth and require a relatively small refractive index range in the order of
$10^{-2}$, which is within the reach of direct laser writing manufacturing
processes such as two-photon polymerization.
