This article gives a recommended approach to the optimization of non-sequential optical systems. The recommended methods are to use Pixel Interpolation, aggregate detector data (moment of illumination data) and the orthogonal descent optimizer. As an example, a free-form mirror is optimized to maximize the brightness of an LED from 23 Cd to >250 Cd in just a few minutes of optimization.
Authored By: Akash Arora
Introduction
Optimization is the process by which a design is improved by changing the values of a set of parameters (called variables) such that the value of a merit function is reduced, or ideally, driven to zero. The process requires definition of performance criteria via the merit function and effective variables to achieve this goal. This article provides a recommended approach for the optimization specifically of non-sequential optical systems. The recommended approach is:
- Use Pixel Interpolation on all detectors that are used in the merit function, to avoid quantization effects due to pixelated detectors.
- Use aggregate data from these detectors, such as RMS spot size, RMS angular width, angular centroid, centroid location etc rather than the data contained in specific pixels. This 'Moment of Illumination' data is much smoother to optimize than any specific pixel's data.
- Use the Orthogonal Descent optimizer at the start of the optimization process, and then refine the result with the damped least squares and/or Hammer optimizers. Othogonal Descent is usually much faster than the damped least squares optimizer, but may yield slightly less optimal solutions. Use Orthogonal Descent first.
As an example, a free-form mirror is optimized to maximize the brightness of an LED from 23 Cd to >250 Cd in just a few minutes of optimization.
Damped Least Squares vs Orthogonal Descent
There are two local optimization algorithms in Zemax: damped least squares (DLS) and orthogonal descent (OD). Damped Least Squares (DLS) uses numerically computed derivatives to determine a direction in solution space which produces a design with a lower merit function. This gradient method has been developed specifically for optical system design and is recommended for all imaging and classical optical optimization problems. In the optimization of pure non-sequential systems however, DLS is less successful because detection is performed on pixelated detectors; the merit function is inherently discontinuous and this can cause the gradient method to fail.
Below is a scan of the merit function of a NS system as a function of just one variable.
It can be seen that for long regions of merit function space, there is no change in the merit function at all, and when change does come it is sudden and discontinuous. This makes optimization by gradient search techniques difficult.
Orthogonal Descent (OD) optimization uses an orthonormalization of the variables and discrete sampling of solution space to reduce the merit function. The OD algorithm does not compute numerical derivatives of the merit function. For systems with inherently noisy merit functions, such as non-sequential systems, OD will usually outperform DLS optimization. It is very useful in optimization problems like illumination maximization, brightness enhancement, and uniformity optimization.
Pixel Interpolation and NSDD
In addition to the specific algorithm used, Zemax contains several features that significantly improve the optimization of NS systems.
As mentioned previously, NS solution space tends be discontinuous due to the pixelated nature of detectors. If the energy in a given ray is assigned to only one pixel, there is no quantitative difference when a system change causes the ray to shift anywhere within that pixel. As a result, optimization is difficult, with discontinuous derivatives in the merit function occurring when a ray crosses the boundary into a new pixel.
This can be illustrated by scanning a single ray across a detector. The universal plot below shows how the irradiance centroid on a detector changes with ray location.
One way to solve this problem is to use pixel interpolation. Instead of 100% of a ray’s energy being assigned to the single pixel struck, a fraction of the energy is apportioned to adjacent pixels based upon the location of the ray intercept inside the pixel. As a result, there is a noticeable change in the merit function as a system change causes a ray to move across a pixel.
Pixel interpolation can be enabled in the Object properties > Type tab.
If we scan a ray across a detector with pixel interpolation enabled, the change in irradiance centroid, and most other criteria, is continuous, and DLS can be easily used.
The irradiance centroid reported in the merit function is computed using the NSDD optimization operand. NSDD stands for non-sequential detector data, and is the most useful operand for reporting incoherent detector data. NSDC is the equivalent for coherent calculations. The syntax for the NSDD operand is as follows:
NSDD
Surf Det# Pix# Data
Surf defines the non-sequential group surface (1 in pure NSC),
Det# defines the desired detector from which to report data (it can also be used to clear one or all detectors),
Pix# defines the specific pixel or computed value to return and
Data defines whether to return flux, irradiance or intensity data. These arguments allow optimization of a number of criteria: minimum spot size (min RMS spatial width), maximum energy (total flux), spatial uniformity (standard deviation of all pixels), collimation (minimum RMS angular width), and more. For a detailed description of NSDD capabilities, see the Optimization chapter in the Zemax user’s guide.
System Setup
Light-emitting diodes (LEDs) are important light sources in a wide range of applications. In areas like automotive illumination and display lighting, it is often required to improve on the brightness of an LED by adding auxiliary optics to modify the luminous intensity of such a source.
We will start with the measured data from a real LED source. See
this article for more details on how the LED is modeled: for now, all we need to know is that a “source radial” is used to input the measured power as a function of angle. The source was measured to have a total output power of 27 Lumens, and is reasonably monochromatic with a peak wavelength of 627 nm. See the article
How to Create a Simple Non-Sequential System if you are not familiar with how to enter this data. The source uses
Sobol sampling for best signal/noise with fewest rays.
Under General...Units we set the system units as follows:
The luminous flux of the LED is measured in units of Lumens so we choose that unit for this simulation. Illuminance is therefore measured in terms of lm/m2, or Lux. Luminous intensity ("brightness") is measured in lumens/steradian or Candela (Cd). Luminance is measured in lm/m2/sr, or Cd/m2, which is sometimes referred to as a nit.
The starting system is set up as follows:
The LED source fires rays onto a flat mirror which then illuminates a detector surface. This file can be downloaded from the link at the end of this article. The detector sees the following spatial and angular distributions:

It can be seen that the mirror is slightly overfilled by the LED, and so the spatial and angular distributions are slightly asymmetric. This is done deliberately, just to add a little more complexity to the design.
Looking at the luminous intensity plot, it can be seen that peak brightness of about 41 Cd occurs at polar angles of around 27 degrees. Rays which are approximately normal to the detector surface have a luminous intensity of only 22 Cd (how this number is obtained is discussed on the next page). Such a profile is not good for a headlamp illumination system, or projector illumination system. It is generally desired to have as high brightness for low-angle rays as possible, so the source can be projected over a distance.
We will now optimize the shape of the mirror to give the highest brightness on axis. To do this, we must perform the following steps:
• Define a merit function that describes what we want to achieve
• Define how the mirror surface can change
• Run an optimization
The Merit Function
A merit function defines the 'quality' of an optical design, in terms of how well the design meets its specified operating characteristics. In this case, we want to get the highest brightness (luminous intensity) at zero degrees angle. This is easily achieved with the NSDD and NSTR operands.
In this design, the detector is object number 3, and we want to obtain the luminous intensity at zero degrees. The detector viewer shows this:
This shows the angular range of the rays that are incident on the detector from the range -90° to +90° in both x and y. No rays land with angles beyond about 35° because the LED does not emit beyond this angle. Peak intensity occurs at around 27 degrees. We are interested in the power landing at angles close to zero. There are two criteria that will target such a distribution: RMS angular width and luminous intensity centroid. The RMS width targets rays to be collimated (i.e. the same angle of incidence), and the centroid targets this angle of incidence to be zero. The following merit function retrieves the luminous intensity seen at this angle:
The first NSDD operand reads out detector object 0, which does not exist; no object 0 can exist. This is a special usage of the operand: Zemax instead clears all detectors. Alternately, detectors may be cleared on an individual basis by defining a negative number (i.e. Det# = -3 clears only detector 3). This is useful in a system with multiple detectors defined.
Then, the NSTR operand tells Zemax to trace rays. The second and third NSDD operands read out detector object 3, centroid x & y (Pix# = -6, -7), data item 2, which is power/unit solid angle. Note that we are targeting the luminous intensity (angular) centroid, not the illuminance (spatial) centroid. The fourth NSDD operand reads out RMS angular width of all pixel data. In addition, the last NSDD operand reports the central pixel (5101) intensity for comparison purposes; note that no weighting is assigned so that it doesn’t contribute to the merit function. This value is approximately 22 Cd.
The last NSDD operand is combined with an OPGT operand to maintain a minimum amount of flux on the detector. We set this to 25 because this is the initial flux on the detector. If this operand didn’t exist, it would be possible to achieve a merit function of zero by removing the mirror altogether! If no energy falls on the detector, the intensity centroid and RMS radius are zero and these are our targets. This “solution” highlights the importance of a well-defined merit function. During optimization, Zemax will attempt to drive the merit function to zero, regardless of what this physically means in the system.
The Free Form Mirror
Free-form surfaces are usually described as multiple low-order polynomials such as splines or Bezier curves. They are often used to describe forms such as turbine blades, car bodies and boat hulls.
In optical system design, however it is often helpful to retain the concept of an underlying conicoid section, and to have free-form deviations from that section. The reason for this will be demonstrated soon. For this reason, we will use the Extended Polynomial Surface object. This surface is described by an equation of the form:
The first term is the standard conic asphere beloved of optical design, and is used for designing spherical, elliptical, parabolic, hyperboloid, etc. mirrors. The second term represents a series of increasingly high-order polynomial deformations from this surface. The polynomials are a power series in x and y. The first term is x, then y, then x*x, x*y, y*y, etc. There are 2 terms of order 1, 3 terms of order 2, 4 terms of order 3, etc. The maximum order is 20, which makes a maximum of 230 polynomial aspheric coefficients. The position values x and y are divided by a normalization radius so the polynomial coefficients are dimensionless.
In this design the maximum order of the polynomial is limited to 20 terms, so the highest freeform deviation goes as x0y5 and x5y0. This is neither necessary nor a recommendation: it was just a choice made during the design process.
Now if we use the Universal Plot to show the central pixel intensity as we scan say the radius of curvature of the mirror as follows:
we see:
This graph illustrates both the difficulty in optimizing NS systems and the need for a well defined merit function. If we look at the overall merit function value versus base radius, we can see why centroid and spot radius are better optimization targets.
Now that our merit function properly defines our design criteria, we will compare the results of optimization with DLS and OD using both local and global optimization algorithms.
Optimization
Zemax contains two “global” optimization routines used to search a larger region of solution space. The Global Search algorithm uses a mixture of genetic optimization, random starting points and local optimization and is good at efficiently searching multi-dimensional parameter spaces for regions of low merit function. The Hammer optimizer also uses genetic and local optimizers to exhaustively refine a design once Global Search has found a promising region of parameter space.
The starting value of the merit function is 14.9, and the brightness at zero degrees is 23 Cd.

We will first optimize with DLS using the local search routine (Tools > Optimization > Optimization…) and compare this with optimization using OD. A final hammer optimization will be performed in both cases.
Now that our merit function and starting system are defined, the only step left is to allocate variables. We have 22 variables at our disposal: radius, conic, and 20 polynomial coefficients. Assign these parameters variable status and start the local optimizer using the DLS algorithm with an automatic number of cycles.
After a short while (11.6 minutes), Zemax comes to a solution. The merit function has fallen to approximately 6.78, with a central pixel brightness of 253 Cd. This optimization illustrates how using pixel interpolation and a well defined merit function allow even the DLS algorithm to work efficiently in non-sequential solution space.
Save the resulting file with a new name for comparison, and reopen the starting point file. This time, allocate all 22 variables and instead optimize using the OD algorithm. Based upon our previous discussion comparing the two local optimization algorithms, we might expect this optimization to proceed faster and arrive at a better solution. Indeed, this optimization takes less than 2/3 the time of the DLS run (7.5 minutes) and achieves a lower merit function value (6.75).
To verify that we have arrived at an optimal solution rather than being stuck in a local minimum, we will run the Hammer optimizer for both systems. The results organized in the table below show minimal improvement on the local optimization results; further illustration of the power of the two local optimization routines.

*Computer specs: Intel Quad core CPU (2.40 GHz), 4GB RAM
The starting irradiance and radiant intensity distributions are shown below, along with the optimized systems using DLS and OD algorithms.
Starting Point


DLS Optimization


OD Optimization


Comparing results, it appears that both optimization methods arrived at similar solutions. Note, however, that optimization with OD was able to achieve slightly better performance in a fraction of the time it took with the DLS method. In fact, it took just several minutes to optimize a system with 22 variables and several different illumination targets! We have gone from a flat mirror to a fully optimized solution in less time than it would take us to tolerance and generate drawings of the system. A sequential system being optimized for spot radius with the same number of variables would require an equivalent amount of time. This example clearly illustrates the efficiency of the OD algorithm when optimizing non-sequential systems. The zip file at the end of this article contains the OD optimized file.
Remember that we never targeted the central pixel brightness directly, but rather it is a byproduct of optimizing for RMS radius and centroid location. We could always put a finite weighting on this criteria, however the RMS radius would most likely increase as a result. You will find that if you target central pixel intensity instead of second moment of illumination, system performance is significantly worse.
Summary
In this article we introduced non-sequential optimization and the different features available to expedite the process. In addition to the algorithm used and scope of search for optimization, Zemax has several features that make non-sequential optimization more efficient. In summary:
• Non-sequential solution space is inherently discontinuous due to computation of criteria on pixelated detectors
• OD is generally superior to DLS for optimizing non-sequential systems
• Pixel interpolation is used to smooth detector data and provide a more continuous solution space for optimization
• The NSDD operand supports efficient optimization of numerous flux, irradiance and intensity criterion
• Optimization targeting the second moment of illumination (RMS angular radius) is vastly superior to targeting central pixel brightness when the goal is beam collimation
• Optimizing a free-form mirror we were able to achieve a 13x improvement in on-axis brightness