### Field tracing for the far-field light-shaping system

We analyze the far-field light-shaping system by physical optics, and illustrate the notation for the later discussion. The considered light-shaping system is shown in Fig. 1(a). The optical element is to shape the input field from the source to its far-field zone in order to achieve a desired irradiance distribution. The field tracing diagram in Fig. 1(b) illustrates the modeling algorithm for the light-shaping system (Fig. 1(a)). In the field tracing diagram, the electric fields, *E*=(*E*_{x},*E*_{y},*E*_{z}), are indicated through the light path, either in the spatial domain (*ρ* domain) or in the spatial-frequency domain (*κ* domain), with *ρ*=(*x*,*y*) is the transversal coordinate on a certain plane and *κ*=(*k*_{x},*k*_{y}) the *x*- and *y*-component of the wave vector. \(\boldsymbol {\mathcal {B}}\) is an operator that indicates the functionality of the optical element, acts on the field in the *ρ* domain. The free space propagation step behind the optical element contains two Fourier transform \(\boldsymbol {\mathcal {F}}\) and \(\boldsymbol {\mathcal {F}}^{-1}\) and a propagation operator \(\tilde {\boldsymbol {\mathcal {P}}}\) in the *κ* domain. Therefore, the field tracing diagram builds up an algorithm that demonstrates how the target field is calculated from the input,

$$ \begin{aligned} \boldsymbol{E}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) &= \boldsymbol{\mathcal{F}}^{-1}\left\lbrace \tilde{\boldsymbol{\mathcal{P}}}\boldsymbol{\mathcal{F}}\left\lbrace \boldsymbol{E}^{\text{out}}(\boldsymbol{\rho}) \right\rbrace \right\rbrace\\ &= \boldsymbol{\mathcal{F}}^{-1}\left\lbrace \tilde{\boldsymbol{\mathcal{P}}}\boldsymbol{\mathcal{F}}\left\lbrace \boldsymbol{\mathcal{B}}\boldsymbol{E}^{\text{in}}(\boldsymbol{\rho}) \right\rbrace \right\rbrace {,} \end{aligned} $$

(1)

where *E*^{in},*E*^{out} and *E*^{tar} are the electric fields defined on the input plane in front of the optical element, the output plane behind the optical element and the target plane on which the signal for the task is given.

Here, we first assume the functionality of the optical element \(\boldsymbol {\mathcal {B}}\) as a phase-only response function to achieve the required output phase. The extra physical effect from the structure of the optical element will then be considered and compensated in the structure design step. Therefore, for the output phase retrieval step, it is assumed that,

$$ \left| {E}_{\ell}^{\text{out}}(\boldsymbol{\rho}) \right| = \left| {E}_{\ell}^{\text{in}}(\boldsymbol{\rho}) \right| \text{,} $$

(2)

where *E*_{ℓ} represents any component of the field *E*, with *ℓ*=*x*,*y*,*z*. \(\left | {E}_{\ell }^{\text {in}}(\boldsymbol {\rho }) \right |\) and \(\left | {E}_{\ell }^{\text {out}}(\boldsymbol {\rho }) \right |\) are the amplitudes of the input and output fields, respectively.

It is noted in [25], that if all the operators in Eq. (1) are pointwise operators, the field tracing algorithm establishes a one-to-one map or so-called homeomorphism between the input field *E*^{in}(*ρ*) and the target one *E*^{tar}(*ρ*^{′}). This is indeed the typical mapping assumption included in all the geometric-optics-based design algorithms.

In fact, due to the homeomorphism is through the whole system, the mapping can be assumed between any two fields in the field tracing diagram (Fig. 1(b)). In the mapping-type Fourier pair synthesis method, the mapping between *E*^{out}(*ρ*) and *E*^{out}(*κ*) is chosen, which is not the same as typical mapping assumption in the literature.

In the following, we compared the phase retrieval methods with these two different mapping assumptions, that one is on *ρ*^{′}(*ρ*) and the other one is on *κ*(*ρ*). And the integrability issue of each method is mathematically discussed.

### Output phase retrieved from the mapping in the spatial domain

For the output phase retrieval based on the mapping *ρ*^{′}(*ρ*), the algorithm is presented as followed.

Considering a lossless system, the flux is conserved at different positions though the system. Therefore,

$$ \iint {E_{e}}^{\text{in}}(\boldsymbol{\rho}) {\,\mathrm{d}}\boldsymbol{\rho}= \iint {E_{e}}^{\text{out}}(\boldsymbol{\rho}) {\,\mathrm{d}}\boldsymbol{\rho}= \iint {E_{e}}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) {\,\mathrm{d}}\boldsymbol{\rho}^{\prime} \text{,} $$

(3)

where *E*_{e}^{in}(*ρ*),*E*_{e}^{out}(*ρ*) are the input and output irradiance distribution. Here, since the optical element is considered in its functional embodiment as a phase-only response function, *E*_{e}^{in}(*ρ*) and *E*_{e}^{out}(*ρ*) is defined on the same reference plane of the optical element and *E*_{e}^{out}(*ρ*)=*E*_{e}^{in}(*ρ*), where *E*_{e}^{in}(*ρ*) is obtained by propagating the source field to the reference plane. *E*_{e}^{tar}(*ρ*^{′}) is the irradiance distribution on the target plane.

Typically in the literature, the homeomorphism is assumed between *E*_{e}^{out}(*ρ*) and *E*_{e}^{tar}(*ρ*^{′}). Therefore, Eq. (3) is derived into its differential form which is also named as the local energy conservation law [11],

$$ \text{det}[J(\boldsymbol{\rho}^{\prime}(\boldsymbol{\rho}))] = \frac{{E_{e}}^{\text{out}}(\boldsymbol{\rho})}{{E_{e}}^{\text{tar}}(\boldsymbol{\rho}^{\prime}(\boldsymbol{\rho}))} {,} $$

(4)

where det[*J*(*ρ*^{′}(*ρ*))] is the determinant of the Jacobian matrix *J*(*ρ*^{′}(*ρ*)).

In general, solving the 2D mapping *ρ*^{′}(*ρ*) from Eq. (4) is specified by a mathematical model, the *L*^{2} Monge-Kantorovich problem, or the so-called “Optimal Mass Transport” (OMT) problem. Several numerical algorithms had been proposed to solve the OMT problem [15, 16].

After the mapping *ρ*^{′}(*ρ*) is solved, by the method of stationary phase according to Bryngdahl [22], the gradient of the output phase is connected with the mapping in the space domain, where their relation is written as:

$$ \nabla \psi^{\text{out}}(\boldsymbol{\rho})=k_{0}n \frac{\boldsymbol{\rho}^{\prime}(\boldsymbol{\rho})-\boldsymbol{\rho}}{\sqrt{\left\| \boldsymbol{\rho}^{\prime}(\boldsymbol{\rho})-\boldsymbol{\rho} \right\|^{2} + L^{2}}} {.} $$

(5)

Here, *k*_{0} is the wave number, *n* is the refractive index in the free space and *L* is the propagation distance between the optical element and the target plane.

The existence and the curl-free characterization of the solution for the *L*^{2} Monge-Kantorovich problem is addressed in the theorem by Brenier [26]. Therefore, a curl-free mapping function *ρ*^{′}(*ρ*) can be solved from Eq. (4). However, due to the nonlinear relation in Eq. (5), ∇*ψ*^{out}(*ρ*) is not necessary a conservative vector field, even though *ρ*^{′}(*ρ*) is. The integrability of ∇*ψ*^{out}(*ρ*) only can be preserved in the paraxial approximation that ∥*ρ*^{′}(*ρ*)−*ρ*∥≪*L*. In general, with the gradient data obtained from the mapping in spatial domain, the required output phase *ψ*^{out}(*ρ*) cannot be reconstructed by direct integration.

### Output phase retrieved from the mapping in the Fourier pair

For the algorithm of the mapping-type Fourier pair synthesis [24], the homeomorphism is assumed between the field of *E*^{out}(*ρ*) and *E*^{out}(*κ*), which are connected in the Parsevel’s equation.

$$ \iint \left\| \boldsymbol{E}^{\text{out}}(\boldsymbol{\rho}) \right\|^{2} {\,\mathrm{d}}\boldsymbol{\rho}= \iint \left\| \boldsymbol{E}^{\text{out}}(\boldsymbol{\kappa}) \right\|^{2} {\,\mathrm{d}}\boldsymbol{\kappa} {.} $$

(6)

If we assume *κ*(*ρ*) is a one-to-one map, Eq. (6) can also be derived to a differential equation.

$$ \text{det}[J(\boldsymbol{\kappa}(\boldsymbol{\rho}))]= \frac{\left\| \boldsymbol{E}^{\text{out}}(\boldsymbol{\rho}) \right\|^{2}}{ \left\| \boldsymbol{E}^{\text{out}}(\boldsymbol{\kappa}(\boldsymbol{\rho})) \right\|^{2}} \text{,} $$

(7)

where det[*J*(*κ*(*ρ*))] is the determinant of the Jacobian matrix *J*(*κ*(*ρ*)).

∥*E*^{out}(*ρ*)∥ is concluded by using Eq. (2). *E*^{out}(*κ*(*ρ*)) can be calculated by an inverse procedure of the field tracing from *E*^{tar}(*ρ*^{′}), where *E*^{tar}(*ρ*^{′}) is usually derived from the given target irradiance *E*_{e}^{tar}(*ρ*^{′}), with the far-field assumption.

We denote the target field explicitly as,

$$ \boldsymbol{E}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) = \left[\begin{array}{c} E_{x}^{\text{tar}} (\boldsymbol{\rho}^{\prime}) \\ E_{y}^{\text{tar}} (\boldsymbol{\rho}^{\prime}) \\ E_{z}^{\text{tar}} (\boldsymbol{\rho}^{\prime}) \end{array}\right] \exp[\mathrm{i} \psi^{\text{tar}}(\boldsymbol{\rho}^{\prime})] {.} $$

(8)

Since the target plane is at the far-field zone, the phase of the target field is an approximated spherical phase which is common for all its three components per definition.

$$ \psi^{\text{tar}}(\boldsymbol{\rho}^{\prime}) = k_{0} n \sqrt{\left| \boldsymbol{\rho}^{\prime} \right|^{2}+L^{2}} {,} $$

(9)

where *L* is the propagating distance from the output plane to the target one.

The amplitude of the target field can be determined by using the given irradiance distribution. Under the far-field assumption, the relation of the irradiance and the electric field is formulated as followed:

$$ \begin{aligned} E_{e}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) &= \frac{n}{2 \mu_{0} c} \hat{\vec{s}}(\boldsymbol{\rho}^{\prime}) \hat{N}(\boldsymbol{\rho}^{\prime}) \left\| \boldsymbol{E}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) \right\|^{2} {,} \end{aligned} $$

(10)

where *n* is the refractive index, *μ*_{0} the vacuum permeability, and *c* the speed of light in vacuum. \(\hat {\vec {s}}\) is the unit vector of the Poynting vector, which can be calculated by \(\hat {\vec {s}} = (x^{\prime }/r, y^{\prime }/r, L/r)\), with (*x*^{′},*y*^{′}) is the coordinate on the target plane, and \(r=\sqrt {x^{\prime 2}+y^{\prime 2}+L^{2}}\). \(\hat {N}\) is the normal vector of the target plane. \(\hat {N}=(0, 0, 1)\) if the target plane is perpendicular to the optical axis. ∥*E*∥ denotes the *L*^{2} norm of the field, with

$$ \begin{aligned} \left\| \boldsymbol{E} \right\|^{2} &= E_{x}^{2} + E_{y}^{2} + E_{z}^{2} \\ &= E_{x}^{2} + E_{y}^{2} + \left(\frac{s_{x} E_{x} + s_{y} E_{y}}{s_{z}}\right)^{2} {.} \end{aligned} $$

(11)

Therefore, by selecting a polarization state, the target field can be calculated from the given target irradiance.

*E*^{out}(*κ*) is then concluded from *E*^{tar}(*ρ*^{′}) via an inverse field tracing, that

$$ \begin{aligned} \boldsymbol{E}^{\text{out}}(\boldsymbol{\kappa}) &= \tilde{\boldsymbol{\mathcal{P}}}^{-1} \boldsymbol{\mathcal{F}} \left\lbrace \boldsymbol{E}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) \right\rbrace \\ &= \exp[-\mathrm{i} k_{z}(\boldsymbol{\kappa}) L] \boldsymbol{\mathcal{F}} \left\lbrace \boldsymbol{E}^{\text{tar}}(\boldsymbol{\rho}^{\prime}) \right\rbrace {,} \end{aligned} $$

(12)

with *k*_{z}(*κ*) the *z*-component of the spatial frequency vector.

After *E*^{out}(*ρ*) and *E*^{out}(*κ*) are prepared, by using the same mathematical model, the *L*^{2} Monge-Kantorovich problem, the curl-free mapping *κ*(*ρ*) can also be solved from Eq. (7).

The stationary phase method is also used to calculate the gradient of the output phase behind the element,

$$ \nabla \psi^{\text{out}}(\boldsymbol{\rho}) = \boldsymbol{\kappa}(\boldsymbol{\rho}) {.} $$

(13)

However, since this time the right side of Eq. (13) is a conservative vector field, ∇*ψ*^{out}(*ρ*) is integrable in any case. Therefore, once *κ*(*ρ*) is obtained, *ψ*^{out}(*ρ*) can be calculated by direct integration, regardless of paraxial or non-paraxial, on-axis or off-axis situations.

So far, we present both the schemes with different homeomorphic assumptions in order to reconstruct a required smooth output phase. The mathematical derivation shows that the gradient information of the output phase calculated with the mapping from the irradiance in the spatial domain cannot satisfy the integrability condition. Instead of introducing extra constraints to the method in the spatial domain, the proposed mapping-type Fourier pair synthesis directly results in integrable data for the output phase reconstruction.