Modelling surface light scattering for inverse two-dimensional re ﬂ ector design

. We present a novel approach of modelling surface light scattering in the context of two-dimensional re ﬂ ector design, relying on energy conservation and optimal transport theory. For isotropic scattering in cylin-drically or rotationally symmetric systems with in-plane scattering, the scattered light distribution can be expressed as a convolution between a scattering function, which characterises the optical properties of the surface, and a specular light distribution. Deconvolving this expression allows for traditional specular re ﬂ ector design procedures to be used, whilst accounting for scattering. This approach thus constitutes solving the inverse problem of light scattering, allowing for direct computation of the re ﬂ ector surface, without the need for design iterations.


Introduction
The engineering field of optical design is concerned with constructing an optical system that produces a desired output light distribution from a given source light distribution. This is often done within the confines of the so-called geometrical optics (GO) approximation, where light propagation is modelled using light rayslines collinear with the Poynting vector. Within the GO approximation, phenomena such as diffraction and interference are typically not accounted for ( [1], p. 159]). Contemporary optical designs sometimes incorporate scattering elements, but due to the absence of such phenomena in the GO approximation, their inclusion is typically realised using trial-and-error in the design phase. This places restrictions on what kind of optical systems one can design, as scattering is difficult to account for in the design process. In this paper, we make a first effort towards constructing a surface light scattering model suitable for inverse reflector design.
There are a myriad of approaches one could consider to include scattering. The most fundamental, and in some ways most natural, approach is that of solving Maxwell's equations directly. This would constitute a substantial departure in terms of strategy, and would in theory work for most realistic systems, but it is often impractical due to spiralling complexity. As such, a number of approximations based on Maxwell's equations have been formulated which are applicable to problems within several regimes of parameter values, such as surface roughness or incident angle. Some highlights include the rigorous vector perturbation theory published by Lord Rayleigh in 1907 [2], and later expanded by Rice (1951) [3], and the rather different Kirchhoff approach, based on random phase variations due to microtopographic surface features, most commonly attributed to Beckmann and Spizzichino (1963) [4]. These approaches are valid in different regimes. In particular, Rayleigh-Rice vector perturbation theory agrees well with experimental measurements of wide-angle scattering (up to approximately 50°of the polar angle of detector/source) for scattering from optically smooth surfaces. Here, "optically smooth" refers to the root mean square (RMS) surface roughness r s divided by the wavelength k being much less than unity, i.e., r s /k ( 1 ( [5], p. 49). The Beckmann-Kirchhoff theory, on the other hand, is valid for rougher surfaces, but due to a moderate-angle assumption as part of its derivation, it is not suitable for use with wide scattering angles and/or large angles of incidence.
There have been numerous developments since these early theories were formulated. Here, we highlight the work of Church, who published multiple papers during the 1970s on Rayleigh-Rice theory in the context of surface scattering from optically smooth surfaces [6]. According to Harvey, his contributions were instrumental in shaping the applied optics community at the time ( [5], p. 50). The last work from EOSAM 2021 Guest editors: Concita Sibilia, Alessandro Belardini and Gilles Pauliat this era we want to highlight is that of Harvey and Shack from 1976, where they developed a linear systems formulation of surface scattering based on a surface transfer function [7]. This approach allows for the use of the Fourier transform of the surface transfer function to compute a scattered radiance function "closely related to the bidirectional reflectance distribution function (BRDF)" ( [5], p. 50). This was later extended to the generalised Harvey-Shack surface scattering theory, which is able to treat arbitrarily rough surfaces with arbitrary incident and scattering angles [8].
Rather than solving Maxwell's equations, with or without approximations, one could alter the GO rays in some manner such that they can be used to compute scattering phenomena. One example of such an approach, that still retains many of the computational benefits of GO, is to modify the GO rays such that they carry information regarding the phase of the light, which can form the basis of diffraction calculations. A good overview of this approach can be found in McNamara [9]. Whilst computationally efficient, such an approach would still require substantial modifications to contemporary reflector design procedures.
In our approach, we remain in the domain of traditional GO, and as an alternative to carrying phase information, we propose a surface scattering model inspired by optimal transport theory [10], which leads to a convolution integral for cylindrically and rotationally symmetric problems with isotropic in-plane scattering. This convolution integral yields the scattered light distribution, given a scattering function and a specular target distribution, where the former characterises the optical properties of the surface. This is a forward problem, but it can also be cast in terms of an inverse problemgiven a desired target distribution and a scattering function, one may perform deconvolution to find an appropriate intermediate specular target distribution, which can in turn be used to design the optical element using traditional specular design methods. Our approach thus allows scattering to be taken into account in a simple pre-processing step, allowing for direct computation of the reflector surface without the need for design iterations or expensive forward raytracing calculations. This is in contrast with the established techniques of designing reflectors with a scattering surface, constituting forward scattering calculations and manual design iterations, i.e., designing a reflector and raytracing with a suitable Bidirectional Reflectance Distribution Function (BRDF) using software like LightTools, Zemax or Code V, followed by making manual adjustments to the reflector surface in an attempt to account for potential discrepancies between the resulting and desired scattered light distributions. The advantage of our approach is thus that we may separate the scattering calculations from the reflector design step, allowing us to greatly benefit from the maturity of specular reflector design procedures, whilst still accounting for scattering.
The computation of specular reflectors has a long history that is largely outside of the scope of this paper. A recent highlight is the development of methods based around solving the Monge-Ampère equation [11,12]. A comprehensive literature review of inverse illumination optics may be found in [11] of Chapter 3. We shall restrict our attention to the two-dimensional procedure developed by Maes ([13], Chap. 3) to compute cylindrically and rotationally symmetric reflectors. To the best of our knowledge, directly computing reflectors with scattering surfaces in illumination optics is very rare; the best reference we have found is Lin et al., who designed a lens with a freeform scattering inner surface and a spherical outer one [14]. The freeform surface was designed by an iterative optimisation procedure whereby a freeform surface represented by Bézier curves was first computed and then modified iteratively to take into account the difference between the prescribed target distribution and a raytraced one.

Summary of main contributions
In words, the main contribution of our approach is that it contains a decoupling between the inverse scattering problem and the inverse reflector computation. This is very powerful, since it allows one to take scattering into account in a pre-processing step, such as in the algorithm below.

Prerequisites
For our method, we require: The effect of each step is shown in Figure 1, with a point source at the origin. We note that the deconvolution requires some care, as a light distribution is necessarily nonnegative. For this reason, we used Richardson-Lucy deconvolution, which guarantees nonnegativity of the solution.
Computing the specular reflector essentially reduces to solving two coupled initial value problems.

Structure of manuscript
The structure of this paper is as follows. Cylindrically symmetric problems with in-plane scattering are covered first, together with a few words about deconvolution in Section 2.1, followed by rotationally symmetric problems with in-plane scattering in Section 2.2. Next, two-dimensional specular reflector design is briefly discussed in Section 3, followed by some results in the form of reflectors and raytraced distributions for validation of both the cylindrically and rotationally symmetric systems in Section 4. Finally, conclusions with some proposals for expansions of the model as well as suggestions for how to relate it to the BRDF are presented in Section 5. Figure 1. The inverse problem of reflector design with a scattering surface; the first step (deconvolution) yields the specular target distribution, which in turn can be used to compute the reflector by solving the inverse specular problem. The data is taken from Example #1 in Section 4. Starting with cylindrically symmetric problems, consider the situation depicted in Figure 2. This specular problem can be viewed as a cross-section of a translationally invariant problem, such as an extruded optical element, with a line-source along the suppressed z-axis. For such a system, the specular problem may be analysed in two-dimensions ( [10], Chap. 3). Thus, the intensities and reflector surfaces are independent of z and we may study a cross-section in the plane of incidence, which is spanned by the source and reflected rays, alongŝ andt, respectively, and which contains the unit normaln. The hat (^) indicates unit vectors throughout this manuscript, and positive angles are by convention counter-clockwise. The reflector is parametrised by rðuÞ ¼ uðuÞê r , where u(u) > 0 is at least twice continuously differentiable andê r ¼ ðcosðuÞ; sinðuÞÞ > is the radial unit vector in polar coordinates. The angle u is measured counter-clockwise from the positive x-axis, and it fully characterises the source ray alongŝ ê r , emitted form the line source at the origin O. The source ray alonĝ s intersects the reflector at some point P, where the unit normal of the reflector is given byn. We take the conventionŝ Án < 0, i.e., the normal is chosen directed towards the light source. From the specular law of reflection (LoR), we get an expression for the reflected direction t ¼ ðcosðwÞ; sinðwÞÞ > , i.e., where we denote the angle between the positive x-axis and t by w.
To introduce scattering, consider the situation depicted in Figure 2b. Inherent in this description is that we assume the scattering is limited to the plane of incidence, so that we can again study a cross-section of the translationally invariant problem. This assumption is made in order to preserve the two-dimensional nature of the specular problem also when considering scattering. We postulate that it is valid for a situation where an extruded reflector is illuminated by a line-source parallel to the extrusion direction. This is because the process of extrusion leads to grooves along the extrusion direction, so that the cross-sectional plane of symmetry is preserved. The validity of this claim has not been investigated further; it is thus an assumption made in the derivation of our two-dimensional surface scattering model. Here, the source ray alongŝ gets mapped to a scattered ray alongû ¼ ðcosðcÞ; sinðcÞÞ T , where c is measured counter-clockwise from the positive x-axis. The scattered directionû can be described as a rotation oft by a stochastic parameter a around the axis parallel to the z-axis passing through P, i.e., u ¼ RðaÞt; where RðaÞ :¼ cosðaÞ ÀsinðaÞ sinðaÞ cosðaÞ : The stochastic parameter a is related to the scattering characteristics of the surface. We note that a depends on w, both in the sense that it will almost certainly have a different stochastic value for a given win fact, since a is sampled from a probability distribution, it has multiple values for all wand in the sense that the probability distribution from which it is sampled may be different for different values of w. We shall return to the meaning of this, both mathematically and physically, in Section 2.1.2.

Mappings
To express reflection and scattering in terms of angles, let us introduce two mappings which give the reflected and scattered directions, i.e., mðuÞ ¼ w and sðw; aÞ ¼ c; J. Eur. Opt. Society-Rapid Publ. 19, 18 (2023) where the former is a reformulation of the law of reflection, and the latter represents the scattering. This might seem superfluous, but it will simplify the discussion later, especially in the general three-dimensional case, which we intend to treat in a future publication. In addition to these maps, we require their inverses to exist, m À1 ðwÞ ¼ u and s À1 ðc; aÞ ¼ w: Finally, we define a mapping yielding the scattering angle a, for fixed w and c, i.e., For a schematic summary, see Figure 3. Explicitly, the maps are sðw; aÞ¼ w þ a c; s À1 ðc; aÞ¼ c À a w; where the first two relations follow from cosðw À uÞ ¼ŝ Át see Figure 2a and the LoR -Eq. (1). The existence of inverse mappings is not a priori guaranteed for all situations, but we shall restrict our attention to those where they do exist.

Energy balances
Having presented the mappings for the angles, we introduce the intensity distributions (illuminance) [lm/rad]: where [u 1 , u 2 ] is the angular span of the reflector, and hence the only relevant interval of the source distribution. The intervals ½w 1 , w 2 and [c 1 , c 2 ] are part of the problem specifications (see the validation examples in Sect. 4). In the design procedure outlined in Section 3, the source and diffuse target distributions, f and h, are given, and the intermediate specular intensity distribution g is computed, and used in the design of the reflector. Assuming no light is lost along the way from source to target, we may formulate the global energy balances as or, in words, the energy of the source is equal to that of the specular target, which in turn is equal to that of the diffuse target distribution. Consider next the relationship between w and c for a fixed w = W. Suppose we have a perfect specular reflector (i.e., a mirror). Then, a always vanishes, such that w c and for fixed w = W, we simply get a fixed c = C. This is depicted schematically in Figure 4a. Suppose instead that we have nonzero scattering, and let the scattering vary depending on the incident angle. This yields a situation like the one depicted schematically in Figure 4b. Here, fixing w = W and tracking where all the light emerges, we see that it falls within the interval ½C 1 ; Motivated by the above observation and the more fundamental concept of optimal transport theory, and in particular Monge-Kantorovich problems ( [10], Chap. 1), let us introduce the density q(w, c) > 0, J. Eur. Opt. Society-Rapid Publ. 19, 18 (2023) that is, given w, integrating q(w, c) over all scattered angles c gives the intermediate specular intensity g(w) in the direction w. Stated otherwise, q(w, c) determines how g(w) is spread over the range of scattered angles c.
Vice versa, given c, integrating q(w, c) over all specular angles w gives the diffuse intensity h(c) in the direction c. There are several natural requirements on q, including positivity and finite support, i.e., it should have nonzero values on a finite domain. In Figure 4b, its support may be considered the shading, where darker values represent a higher density, and the support is clearly a function of the angles, i.e., the scattering is spatially varying. Notice that the second energy balance in equation (7) is trivially fulfilled by direct substitution: which are the same after a change of integration order. Before defining this density q explicitly, we note that it is closely related to the bidirectional reflectance distribution function (BRDF), which is defined as the ratio between the outgoing radiance and the incoming irradiance on some small area element [15]. In a future publication, we shall explore this connection, and show for which circumstances the choice of q we make below is valid. For now, we shall make an ad hoc choice of the density q. In particular, consider qðw; cÞ ¼ pðaðw; cÞ; wÞgðwÞ; where p is a function describing the redistribution of light, subject to an energy constraint we shall formulate momentarily. Physically, this choice can be motivated as follows. In the specular case, i.e., Figure 4a, p(a(w, c); w) = p(c À w) = d(c À w), where d represents the Dirac delta function, meaning the light will be scattered in exactly one direction c w. When p is some other appropriate function, light in direction w is scattered over multiple angles and we have a situation similar to that in Figure 4b, i.e., the choice of q in equation (10) represents the physical properties of light scattering. Note, however, that p includes the parameter w, which highlights the possibility of unique p functions for each specular ray, which is what is schematically shown in Figure 4b since the support varies with w. Inserting this density in equation (8a), transforming the integration variable c to a, and noting that with our maps, the Jacobian |os/oa| = 1, we get Z a 2 a 1 pða; wÞ da ¼ 1; ð11Þ From equation (12) and using the fact that g(w) ! 0, it is clear that p(a; w) ! 0, i.e., with this choice of q, p becomes a probability density function (PDF).

Integral equation
Let us now focus on the second integral relationequation (8b). Substituting our choice of q(w, c) from equation (10) yields We once again utilise a = a(w, c) to change the integration variable from w to a, together with w = s À1 (c; a), to get where a 1 and a 2 were defined after equation (13). Here, we note that this is a Fredholm integral equation of the first kind for g, as p depends on both c (via w = s À1 (c; a)) and a. That is, p is a spatially varying kernel function, h is the prescribed target and g is to be determined. Under the assumption of isotropic scattering, the explicit w-dependence in p is omitted, meaning we get p(a(w, c)), or simply p(a). The w vs. c plot for such a situation is shown in Figure 5. In contrast to Figure 4b, the support of q is now a band of constant width, and the data represent that of Example #2 in Section 4. Inserting a(w, c) and s À1 (c; a) from equation (6) into equations (12) and (13) yields which are convolution integrals. We shall use the common notation of h(c) = (p*g)(c) for the convolution in equation (14a). Due to the commutativity property of convolution integrals, an equivalent definition is h(c) = (g*p)(c) in equation (14b) ( [14], p. 309). Obtaining g is now a matter of deconvolving equation (14a) or (14b). There are a large number of different deconvolution methods, but not all are equally suitable for our purposes. In particular, g must be nonnegative within a finite domain. This can be achieved using an iterative ratio method, such as Gold's method, or the more common Richardson-Lucy method of deconvolution [17]. We shall return to this topic in Section 4.

Rotationally symmetric reflectors
To introduce rotationally symmetric, consider Figure 6a. The situation is as follows. A point-source is located at the origin O. The reflector is parametrised by rðu; 0Þ ¼ uðuÞê r , where u(u) > 0 is at least twice continuously differentiable andê r ¼ ðsinðuÞ cosð0Þ; sinðuÞ sinð0Þ; cosðuÞÞ > is the radial unit vector in spherical coordinates. The angle u 2 [0, p) is measured from the positive z-axis and the angle 0 2 (Àp, p) is measured from the positive x-axis. Consider now a ray in directionŝ ê r emitted from the point source at O. Following its trajectory, it strikes the reflector at a point P, where the unit normal to the surface (not shown) is given byn. Like in the cylindrically symmetric case, we adopt the conventionŝ Án < 0, i.e., the normal points towards the light source. From the LoR, equation (1), we get an expression for the reflected rayt.

In-plane scattering
If, in addition to the reflector being rotationally symmetric, the scattered direction is assumed to be in the plane of incidence, the problem may be analysed in two dimensions. The fact that the specular problem reduces to two dimensions is shown in [10] of Chapter 3, and in-plane scattering preserves this symmetry. The situation is shown in Figure 6b, depicting the cross-section in the plane of incidence (here taken as the xz-plane to distinguish from the xy-plane used in the cylindrically symmetric problems). The twodimensional reflector is parametrised by rðuÞ ¼ uðuÞê r , whereê r ¼ ðsinðuÞ; cosðuÞÞ > , u 2 ½0; pÞ measured from the positive z-axis. The source rayŝ ê r intersects the reflector at a point P with unit normaln, and the specular directiont ¼ ðsinðwÞ; cosðwÞÞ > , w 2 ½0; pÞ (not shown) measured from the positive z-axis, is given by the LoR, equation (1). The scattered directionû ¼ ðsinðcÞ; cosðcÞÞ > , c 2 [0, p) measured from the positive z-axis, is given by a rotation by a stochastic parameter a oft, in accordance with equation (2), around an axis parallel to the suppressed y-axis passing through P.
Before proceeding, let us briefly discuss when such an approximation is valid. The rotationally symmetric reflector is self-explanatory, but the in-plane scattering is less straight-forward. The proposed situation where this may hold is as follows. A rotationally symmetric reflector was machined in a manner which left the surface chiselled so that the chisel-marks follow a tightly-wound spiral along the reflector. In this situation, we postulate that we may study the cross-section in the plane of incidence, since the symmetry of the problem is preserved. Within these restrictions, i.e., a rotationally symmetric reflector subject to our postulate of in-plane scattering only, we may readily use the formulae in the prior sections, with a few changes that shall be highlighted shortly. We furthermore assume that the intensity distributions are rotationally symmetric, such that the following description will suffice [lm/rad]: source intensity distribution f(u) > 0, u 2 [u 1 , u 2 ], intermediate specular intensity distribution gðwÞ > 0; w 2 ½w 1 ; w 2 , diffuse target intensity distribution hðcÞ > 0; c 2 ½c 1 ; c 2 .
The energy balances in equation (7) become where the sine terms come from the spherical area elements. Following the procedure in the previous section, let us introduce the density q(w, c) ! 0, w 2 [w 1 , Comparing these equations to equation (8), notice that they are the same up to the sine terms from the spherical area elements. As such, the natural choice for q becomes (recall Eq. (12); assuming isotropic scattering, i.e., no explicit w-dependence) qðw; cÞ sinðcÞ ¼ pðaðw; cÞÞgðwÞ: We now substitute this q into equation (16a) to get the normalisation condition Z c 2 c 1 pðaðw; cÞÞ dc ¼ 1: Transforming c to a yields Z a 2 a 1 p a ð Þ osðw; aÞ oa da ¼ 1; J. Eur. Opt. Society-Rapid Publ. 19, 18 (2023) where a 1 and a 2 were defined after equation (11). The Jacobian |os/oa| = 1 via the mappings in equation (6). Whence, the normalisation of p is Z a 2 Substituting q, defined in equation (17), into equation (16b) yields Absorbing the sine terms in the intensity distributions by defining hðcÞ :¼ hðcÞ sinðcÞ;gðwÞ :¼ gðwÞ sinðwÞ; and inserting a(w, c) from equation (6), yields where the second equation is obtained by transforming w to a. Comparing these to equations (14a) and (14b), it is clear that they are the same, up to the sine terms from the spherical area elements in the modified distributions. As such, deconvolution is still a vital tool to obtain the specular target distribution used in the reflector design procedure.

Specular reflector design
Having obtained a specular target distribution via deconvolution, our goal is as follows. Determine a specular reflector which transforms the given source distribution f into the given target distribution g. The approach we have chosen involves solving two ordinary differential equations (ODEs) for the radius function u(u) and the mapping m(u), which together fully characterise the reflector. This is similar to the approach outlined in [13] of Chapter 3.3. Note that the resulting equations are scale-invariant, so the physical size of the final reflector is arbitrary and can be decided by the optical engineer by choosing appropriate units of length.

Cylindrically symmetric reflectors
Recall that the reflector is parametrised by rðuÞ ¼ uðuÞê r , and that u is measured counter-clockwise from the positive x-axis (refer to Fig. 2). To start, note that a tangent vector to the reflector is whereê r ¼ ðcosðuÞ; sinðuÞÞ > andê u ¼ ðÀ sinðuÞ; cosðuÞÞ > are the standard unit vectors in polar coordinates, and where we made use of the relationê r 0 ¼ê u . The corresponding normal vector can be constructed by rotating s counter-clockwise, i.e., where the rotation matrix R was initially defined in equation (2). The associated unit normal iŝ where we made use of the fact that Rðp=2Þê r ¼ê u and Rðp=2Þê u ¼ Àê r . Let vðuÞ :¼ lnðuðuÞÞ, so that Let us computeŝ which we shall use momentarily. In doing so, we made use of the relationŝ ê r . Note thatŝ Án < 0, indicating we rotated s the correct way to get n. From the LoR, equation (1), we getŝ By geometrical argumentssee Figure 2a it is clear that s Át ¼ Àŝ Á Àt ¼ cosðw À uÞ, such that together with equation (28), we get or, equivalently v 0 ðuÞ ¼ AE where we used the tangent half-angle relation ( [16], p. 127) and switched from w to m(u) in the last step to highlight that this is indeed the specular maprecall Figure 3, which has an explicit u-dependence. To solve this ODE, we shall make use of the arbitrary initial condition v(u 1 ) = 0. We thus have the initial value problem (IVP) This IVP describes the rate of change of the reflector radius function u, via v = ln(u), such that each incident angle u is converted into the corresponding specular angle w = m(u). At this stage, m is still unknown, and it is determined by the first energy balance in equation (7).
As an example, we consider a monotonically increasing or decreasing optical map m(u). Suppose we have a monotonically increasing function mðuÞ ¼: m div ðuÞ, together with the condition m div ðu 1 Þ ¼ w 1 , such that the reflected rays do not intersect, i.e., the ray bundle is divergent. Since m div is by construction a valid solution, i.e., it achieves g, given f, the following must hold for all u 2 [u 1 , u 2 ] (recall that w 1 < w < w 2 ) Z u i.e., the total flux in the interval [u 1 , u] emitted by the source is equivalent to the reflected flux in the image interval [w 1 , m div (u)]. Differentiation with respect to u immediately yields the IVP m 0 div ðuÞ ¼ f ðuÞ gðm div ðuÞÞ ; m div ðu 1 Þ ¼ w 1 : Once the desired m(u) has been obtained by solving the corresponding IVP, it is substituted into equation (32), which is then solved, yielding vðuÞ and consequently uðuÞ ¼ e vðuÞ , which fully characterises the reflector. Throughout this paper, we have utilised Matlab's ode15s routine to solve the IPVs.

Rotationally symmetric reflectors
In the case of rotationally symmetric reflectors, we measure u 2 [0, p) from the positive z-axis, in the plane of incidence recall Figure 6b. Since # is constant, the reflector is parametrised by rðuÞ ¼ uðuÞê r , whereê r ¼ ðsinðuÞ; cosðuÞÞ > is the radial unit vector in this particular polar coordinate system. Thus, the tangent vector becomes whereê u ¼ ðcosðuÞ; À sinðuÞÞ > is the angular unit vector in this polar coordinate system. To obtain the unit normal pointing towards the source, we rotate the tangent vector clockwise, i.e., Following the procedure from the previous section, we end up with a unit normaln after introducing vðuÞ :¼ lnðuðuÞÞ. Finally, we consider the geometry of the situation (see Fig. 6b; w is analogous to c) to conclude thatŝ Át ¼ Àŝ Á Àt ¼ cosðw À uÞ, so that together with the law of reflection, equation (1), the boundary condition v(u 1 ) = 0, and the tangent halfangle relation, we once again arrive at the IVP in equation (32). As in the cylindrically symmetric case, suppose we have a monotonically increasing specular map mðuÞ ¼ m div ðuÞ. Then, for any u 2 ½u 1 ; or, formulated as an IVP m 0 div ðuÞ ¼ f ðuÞ sinðuÞ gðm div ðuÞÞ sinðm div ðuÞÞ m div ðu 1 Þ ¼ w 1 : With these changes in mind, and the knowledge that the IVP for v remains the same, we can conclude that the design procedure outlined previously may be used without further modifications.

Raytracing
Irrespective of how the reflector is computed, and whether it is cylindrically or rotationally symmetric, a validation method is required. The natural choice is raytracing, and we have written our own two-dimensional raytracer, since we must have full control of how the scattering occurs at the surface in order to validate our model. In particular, source, specular and diffuse (i.e., scattered) rays are all collected. The source rays are generated from the appropriate source distribution using Matlab's rand routine, followed by an intersection computation. When computing the reflector, we are left with discrete data points, and these form reflector segments via piecewise-linear interpolation. As such, all rays that fall within a reflector segment will use the same normal in the computation of the reflected direction. The intersection point for a given source ray is decided by computing the angle of a line connecting the centre of each reflector segment and the origin O, and then comparing these angles to that of the generated ray using Matlab's dsearchn routine. The specular rays are then computed using the law of reflection, equation (1), whilst the diffuse rays are computed using a rotation matrixrecall equation (2). The stochastic parameter a is sampled from the chosen scattering function p. We shall use either a Gaussian and Matlab's randn routine or a Lorentzian (Cauchy distribution) and Matlab's rand routine in the corresponding cumulative distribution function. The ray collection is performed by equidistantly dividing the relevant angular domain ((Àp, p) or [0, p), for cylindrically and rotationally symmetric distributions, respectively), thus forming collection bins. The centres of the collection bins are known, and the appropriate bin for a given ray is then computed via a nearest point search using dsearchn, and the number of rays collected by that bin is incremented by unity. After this, the process is repeated until the requested number of rays have been traced though the system. Finally, the number of rays per collection bin is converted into an intensity by dividing the probability of falling in each bin by the size of the bins and multiplying with the total flux of the source, i.e., for cylindrically symmetric reflectors, and for the jth bin.
Here, Pr(u jÀ1 u < u j ) is the number of rays in the jth bin divided by the total number of rays traced, i.e., the probability of falling in the jth bin, and Du is the angular size of the collection bins. The total flux of the source is given by the integral over f. For rotationally symmetric reflectors, we have More details regarding raytracing are available in [18], p. 34.

Angle convention
We adopt the (Àp, p) angle convention for cylindrically symmetric reflectors, so that we can make use of Matlab's atan2 function to compute the angles of the rays. The rotationally symmetric problems will still use the polar [0, p) convention. In addition to this, we shall define our target distributions in terms of j(w) and j(c), where

Validation criterion
We utilise raytracing as a validation technique, so let us define a criterion to quantify the differences between the raytraced and predicted distributions. Specifically, we use the root mean square (RMS) error defined as follows where N is the number of collection bins of h*, and the star indicates raytraced distributions. In most of our examples, we use the deconvolved (subscript "dc") specular distribution g dc , obtained by deconvolving equations (14) or (23) when designing the reflectors. In this case, h and h* will be h rc and h Ã rc , respectively, where the "rc" subscript signifies "reconvolution", that is h rc :¼ g dc Ãp.

Examples
This section presents three sample problems: two exhibiting cylindrical symmetry and one with rotational symmetry. To verify our model, we prescribe the specular target distribution g exactly, and construct the diffuse target distribution h by convolving g and the chosen scattering PDF p. We then compute the deconvolved specular distribution g dc , which is used to design the reflectors. Finally, we raytrace the system and compare the result to our prediction. In the rotationally symmetric example, we no longer know the exact g, but rather we prescribe h exactly. This is more similar to how we envision an optical designer working with our model.
The computation time for these examples may be divided as follows (times given for a portable workstation with 4 cores, 8 threads @ 4 GHz and 32 GB of RAM): Computing the deconvolution: -Depends on the number of distribution bins.
-Can be done very efficiently using Matlab routines, such as the built-in deconvolucy routine we used. -Using efficient routines, this step takes a few seconds on our machine.
Computing the specular reflector: -Depends on the number of reflector segments, distribution bins, and the stiffness of the ODEs. -Involves solving two IVPs, which can be done using various methods, such as Matlab's ode15s routine, which we used. -For simple problems, like our examples, this step takes up to a minute; for difficult problems it can take a few minutes.
Validating the reflectors using raytracing: -Depends on the number of rays traced.
-This step can be parallelised to a very large extent, and modern consumer GPUs have dedicated raytracing hardware. -Using our raytracer in Matlab without any raytracing hardware and tracing a total of 10 6 rays, this step takes a few minutes.
From the above list, it is clear that the step we propose in this paper, the deconvolution step, takes the least amount of time.

Example #1: smooth target distribution
The specular problem consists of a homogeneous source f being transformed into two partly overlapping Gaussians g. As for the choice of p, we opted for a Gaussian centred around a = 0°, with standard deviation r = 10°. This is supposed to represent relatively minor scattering when compared to, e.g., Lambert's cosine law, whilst still being a significant deviation from a specular reflector. The diffuse distribution h is the convolution between p and g, i.e., h = p*g. Worth noting is that Gaussians do not have finite support, meaning we need to truncate the nonzero values outside of [a 1 , a 2 ] when performing the (de-)convolution. We re-normalised p after truncation to ensure that Z a 2 a 1 pðaÞ a ¼ 1. The problem is summarised in the box below, where represents the Gaussian, centred at l with standard deviation r. The value of u 2 was chosen such that energy is conserved up to Since we are interested in validating the whole proposed solution method, the first step is to find the specular target distribution g dc by deconvolution. We shall utilise Richardson-Lucy deconvolution, and in particular Matlab's deconvlucy routine. This iterative ratio method has numerous benefits compared to direct methods, most crucial for our purposes being guaranteed positivity of the solution. The functions f, g, g dc , p, h, and h rc are shown in Figure 7, for deconvlucy's default settings of 10 iterations with 128 sampling points. Clearly, the recovered g dc resembles the original g relatively well (and it could be improved by increasing the number of deconvolution iterations), and the reconvolved h rc = g dc *p is nearly identical to h. The next step is to design the reflectors. In order to use the procedure outlined in Section 3, we need the limits w 1 and w 2 . Recall that these should represent the support of g (or, rather, g dc in this case). In this example, the limits are ambiguous due to the Gaussians. We computed the limits by fixing a threshold g = 0.001 and locating the two extrema of j(w) where g dc (w) = g, using piecewise-linear interpolation between the data points of g dc . The limits are shown in Figure 8, and the reflectors are shown in Figure 9. In this case, we do not know the exact solutions, so we shall not discuss the reflectors further for this example. We note that one could renormalise g dc to ensure more accurate energy conservation, but this has not been done in the data shown. We have used 1024 sample points for the reflectors in an attempt to minimise discretisation errors due to the reflectors when validating the m conv reflector using raytracing (recall that each ray striking a reflector segment uses the same normal). The sample points are equidistant in the [u 1 , u 2 ]-range. The raytraced distributions and the RMS error from equation (47) are shown in Figure 10, where we see that the source sampling is appropriate, and the resulting distributions are well predicted by our model. In addition, the convergence shows the expected N À1=2 r behaviour of Monte Carlo raytracing ( [18], p. 9), where N r is the number of rays traced through the system.
There are a couple of regions where the raytraced distributions deviate from our predictions. Specifically, f Ã near u 1 ¼ Àp=4 and u 2 ¼ 29p=75, g Ã dc near jðw 2 Þ % 1:26 and near both peaks of the Gaussians. The discrepancies in f Ã are due to the bins not aligning perfectly with the support of f , such that part of a collection bin may cross the u 1 -and u 2 -boundaries. The discrepancies of g Ã dc are presumably partly due to energy not being perfectly conserved, and partly from the discretisation of the reflector surface, in addition to the aforementioned binning issue. Additionally, the very peaks of the Gaussians are only one or two data points wide, and achieving that level of precision is no easy feat, using a numerical scheme. Keeping all of these factors in mind, the results are promising, and from the RMS error plot, we see that increasing the number of rays is likely to improve the result further.

Example #2: Block function as target distribution
We now move on to our second example, which at first appears much simpler, but will prove to be quite a challenge for our numerical scheme. The specular problem consists of homogeneous illumination of a circular disk within ½w 1 ; w 2 and f is homogeneous on ½u 1 ; u 2 . The scattering PDF p is still a Gaussian, this time with a standard deviation of   r = 5°. We employ a similar approach to the first example, i.e., prescribe g, compute h ¼ gÃp and attempt to recover g via deconvolution, then validate the reflectors we designed using g dc with raytracing. The example is outlined in the box below. We wish to highlight that the density qðw; cÞ for this example is shown in Figure 5.
Using the default settings of deconvlucy (10 iterations) yields g dc in Figure 11, where we immediately see that it    deviates significantly from the original g. Readers who are familiar with signal theory are likely not surprised by this, as representing a block function in Fourier space requires an infinite number of frequencies. Let us attempt to increase the number of deconvolution iterations by an order of magnitudesee Figure 12a. This shows a slight improvement, but we are still quite far from the original g. As such, let us further increase the number of iterations by two orders of magnitude to get the result in Figure 12b, which is certainly a lot closer to the original g. The RMS error e (g, g dc ), recall equation (47), decreased from 0.055 to 0.020 and 0.005, for 10, 10 2 and 10 4 iterations, respectively. In a real problem, this metric would not be available to us, so we would have to rely on the RMS error e(h, h rc ), which decreased from 10 À3 to 10 À4 and 10 À6 . Based solely on e(h, h rc ), it is not unreasonable that one might design the reflector using the first g dc , so we shall include it as a worst-case scenario, as well as the best g dc, , in the sense that it has the lowest RMS error.
Turning to the topic of reflector design, consider the reflectors in Figures 13a and 13b, designed using the original g and the deconvolved g dc in Figure 11, respectively. We note that the exact solutions to this problem are given in [13] (p. 28) as a circle segment and a straight line, i.e., we recover them using our numerical scheme. To the naked eye, the two figures appear nigh identical, and it is only when we plot the difference in radii of the m conv reflectors in Figure 14 that we can appreciate the differences. From Figure 13. Example #2; reflectors designed using g in Figure 11 (a), and g dc after 10 deconvolution iterations in Figure 11    the raw (or unaltered) graph, we postulate that the deviations can be decomposed into a sloped straight line and comparatively small oscillations. In order to better appreciate the oscillations, we thus subtracted a linear correction factor from the raw data. This reveals the profile of g dc (w), w 2 [w 1 , w 2 ], present in the reflector surface. Notice that the order of magnitude of the oscillations in the reflector surface is significantly smaller than that of the oscillations in the specular target distribution. In other words, small changes in the reflector can result in significant changes to the resulting distribution.
Shifting focus to raytracing, the results are shown in Figures 15a-15c with g and g dc from Figure 11 (10 iterations) and g dc from Figure 12 (10 4 iterations), respectively. In all these cases, we used a total of 10 6 rays, and the m conv reflectors. It is clear that the scheme works well, and the issues we see were explained when discussing the previous example. That is, binning and numerical errors due to discretisation. A slight asymmetry appears in the results for the reflectors designed using the deconvolved g dc distributions. This can also be seen from the slope in Figure 14, so the cause appears to be somewhere in the numerical computation of the reflectors, presumably due to integration from left to right. The discrepancy is minor, so an attempt to correct it has not been made, as it is clear that the model predicts the scattered distribution very well, and that the resulting reflector can be validated using raytracing.

Example #3: Lorentzian scattering function
The rotationally symmetric example we have chosen differs from the previous examples in two major ways. The first is that we no longer know the exact g, but rather we prescribe an exact h. This is more similar to how we envision an optical designer would incorporate our model in their workflow. The second difference is that the scattering function is a Lorentzian (also known as a Cauchy distribution). This is significant for two reasons, namely that machined mirrors often exhibit this type of bidirectional reflectance distribution function (BRDF) ( [19], Chap. 4), and because the tails fall to zero at a significantly lower rate. The latter fact means that more large-angle scattering will occur when compared to the Gaussians we have used thus far. As such, we increase the relevance of the method whilst testing the limits of our model. The example is outlined in the box below, where Lðh; rÞ ¼ 1 pr is the Lorentzian function with a full width at half maximum (FWHM) of 2r; r is often denoted c in literature, but not here for obvious reasons. Note that we again truncated the values of p outside of [a 1 , a 2 ] and renormalised, such that Z a 2 a 1 pðaÞda ¼ 1.
The distributions are shown in Figure 16, where we have opted to absorb the sine terms from the energy balances, equation (15), into the distributions (indicated by the tilde). The deconvolved specular target distributiong dc was computed using the default deconvlucy settings with 10 iterations. Before designing the reflectors, let us briefly consider what to expect from the final raytraced distributions. In particular, since we have prescribed h, rather than g, we are no longer guaranteed that the deconvolution converges. We can get an appreciation for this by comparing the reconvolvedh rc :¼g dc Ãp with our prescribed h in Figure 16. This may seem like a disappointing result, but let us compareh,h rc andhÃp, where the latter would be the diffuse result if we disregarded scattering in the design procedure entirely, i.e., if we designed the reflectors using f and took h as g in the design procedure, and raytraced the optical system using our scattering model. All   of these distributions are shown in Figure 17, and the RMS error eðh;hÃpÞ ¼ 0:0624, whilst eðh;h rc Þ ¼ 0:0356, i.e., our approach represents an improvement of approximately 40%. Visually, we see that the problematic regions forh rc are partly the peaks and partly near jðc 1 Þ % 1:02 and jðc 2 Þ % 2:22. The deviation close to the peaks could perhaps be improved by increasing the number of deconvolution iterations, but the problems close to the boundaries are not solvable in our model. This is due to an inherent "maximum steepness" dictated by the least steep function we are deconvolving (in this case p), and it is a property of deconvolution. The only way to reach the correct values at the boundaries is to introduce negative values outside of them, which would be unphysical.
We are now ready to design the reflectors. By fixing g = 0.001 and locating the two values of jðwÞ where g dc ðwÞ ¼ g, we found jðw 1 Þ ¼ 1:08 and jðw 2 Þ ¼ 2:14, see Figure 18. The reflectors computed using g dc as the specular target distribution and f as the source distribution are shown in Figures 19a and 19b, where the latter is a threedimensional version of the m conv reflector. The raytraced distributions are shown in Figure 20a, where we see that the source samplingf Ã is correct, as is the resulting diffuse distributionh Ã rc . As for the intermediate specular target distribution, some deviations from the targetg dc may be seen, especially near the first peak. These deviations are presumably due to difficulties solving the relevant IVPs that give the reflector radius function u, and they are likely the reason why our RMS error convergence slows down after approximately 10 5 rays. For the sake of completeness, we also raytraced the m div reflector in Figure 20b. Here, we only showg dc ,g Ã dc ,h rc andh Ã rc , since the source sampling is identical. It is clear that the diffuse distribution is still very closely achieved, whilst the specular distribution deviates in more obvious ways than with the m conv reflector. This highlights the non-triviality of designing specular reflectors, rather than any apparent flaw in our model of scattering, and it could perhaps be improved by increasing the sampling frequency of the distributions, or altering the number of samples in the reflectors themselves. This has not been attempted, since we are mostly interested in validating our model for scattering, and indeed, even with these deviations from the specular target distribution, the effect of scattering smoothes them out greatly.

Conclusions
We have presented a novel modelling approach to include surface scattering in the design of reflectors as part of optical systems. The approach is inspired by concepts from optimal mass transport theory, and it relies on energy conservation. In the case of isotropic in-plane scattering and cylindrical or rotational symmetry, the forward expression of the scattered light reduces to a convolution integral between a probability density function and a specular target function. By prescribing a desired diffuse target distribution, and the scattering probability density function, one can solve for the specular target distribution using deconvolution methods from literature, and then compute the reflectors using purely specular design procedures. As such, including the effects of scattering can be considered a pre-processing step, and all the mature specular reflector design procedures remain essential. This gives the optical designer a greater ability to use scattering to their advantage, or mitigate it in applications where it is undesirable.
We view this work as a proof of concept and as an important first step towards a generalised threedimensional model of surface scattering using geometrical optics, with the ultimate goal of computing freeform reflectors with scattering surfaces. Lifting the requirement of in-plane scattering would significantly increase the applicability of our model and we are actively working in this direction. Additionally, a manuscript exploring the connection between this work and BRDF functions is currently in review.