**[»] Tutorials**and

**[»] Optics**.

In our [»] previous post we have seen a qualitative way to assess an imaging system optical quality by simulating image transfer through the system. Despite it might look like the ultimate analysis tool at first sight, we also saw that it is actually rarely used by optical designers due to its lack of quantitative figures nature and its high processing time.

Here, we introduce a first quantitative tool that is widely used by optical designers to assess the performance of their system during the design phase. Almost all optical design reports I have seen always included plots like the ones shown in this post. Also, it is fairly easy for customers to understand them and they are therefore excellent communication tools as well. They are not, however, the silver bullet of optical design because they lack a description of the diffractive effects of the system.

For this post, let us consider the very simple optical system of Figure 1 which consists of a positive singlet and a negative field flattening lens. Do not worry if these terms does not ring a bell at the moment, we will have plenty of time to discuss them in future posts.

The system in Figure 1 also includes three field angles which are 0°, 3.5° and 5°. It is very common for optical designers to consider three fields for simple designs like this one; one of them will be on-axis, another one will be the maximum off-axis angle and the third one will usually be 70% of the maximum off-axis angle. You may ask why 70% and not 50% and this is because half of the image disk is comprised below 0.7×ϴ_{MAX}. The revolution symmetry of the system also allows to only consider the upward direction as the downward will be symmetrical.

We will now look at how rays intercept the image plane. Since we intercept a surface, we are left with only two coordinates that we can display as a plot. This is exactly what is shown in Figure 2 for the three field angles. Note that we are not restricted to planar image surface and we could have used any type of surface. Most detectors, like cameras, are planar though.

Up to now, it is not different from the approach we used to [»] simulate images except that we restrict ourselves to a very limited number of field positions (3 here against 512×512 in our image simulation of last post) and that we typically trace less rays through the system.

The difference comes from the fact that we will not decay the information by accumulating the points in an output image this time but we will study how the points are distributed. Indeed, the images of Figure 2 might be misleading because the center of the plots are usually much more densely distributed than the edges and if we were to actually accumulate the rays in an output image they would display a much tighter pattern than what appears in the plots here.

For this reason, a ray spot diagram like these ones are always annotated with the RMS value of the distribution of the rays:

where *(x _{i},y_{i})* are the positions of the

*N*rays and

*(x*is the center around which the spot size needs to be evaluated.

_{c},y_{c})There are two center types that are regularly used: the plot center of mass or the chief ray. The chief ray is the ray that passes through the center of the pupil. By default, ZEMAX OpticStudio always use the chief ray as center coordinates even if the center of mass may be more accurate for off-axis rays which often have asymmetric distributions.

For the plots of Figure 2, we obtain 13.114 µm for on-axis, 13.367 µm for the 70% off-axis and 20.909 µm for the full off-axis distributions. We see that despite the two first distributions have different looking, they have about the same RMS spot size and will therefore have comparable aspect on an image when accumulated. On the other hand, the last distribution has a significantly higher RMS value which indicates that rays on the outer part of the image will be more aberrated than rays in the center part of the image.

As an optical designer, this is an alert that the system either needs to be restricted to a smaller maximum field angle or that the optical layout needs to be complexified to achieve higher quality at the edge.

Note that the shape of the spot diagrams also often gives indication on the type of aberrations present in the system (spherical aberration, coma, field curvature, astigmatism, distortion etc.) but we will skip this part for the moment, as I will come back to this when we discuss third-order aberration theory later.

We will now focus on an important aspect of spot diagrams that is unfortunately often overlooked by optical designers.

Up to now, we have traced rays from point sources through the pupil of the system to the image plane but I did not say how we actually sample rays in the pupil. I intentionally did not address this in the previous post about image simulation either because it is an important piece of work that needs to be discussed in details.

By default, OpticStudio uses an uniform sampling in *X* and *Y* direction which corresponds to a **square grid sampling** which is shown in Figure 3. On the left hand-side you see how rays are sampled in the pupil and, on the right hand-side, you see the distribution pattern on the image plane for on-axis rays (the same could have been done for off-axis rays). The sampling is limited here to a disk since most STOP apertures are circulars but this is not a limit to the method. Note that the distribution on the right as a much smaller size than the one on the left (typically on the order of µm vs. mm) but are shown scaled to better visualize how the distribution is transformed.

The square grid sampling is the most straightforward method to implement and is therefore the most widely used sampling method in raytracing. The RMS spot size of Figure 3 is found to be 13.225 µm.

Let us now check a different sampling method, the **polar grid sampling**, for which the results are shown in Figure 4.

We immediately see that the image plane distribution looks different from the one of Figure 3 but it is not limited to a simple appearance because the RMS spot size is now 13.005 µm, almost a 2% difference. Grid sampling therefore affects both the qualitative and the quantitative aspects of spot diagrams.

Note that if you plan to implement polar sampling yourself, you must ensure that the distribution density is regular and that you do not sample the pupil more at the center than at the edge which would produce biased RMS values. For polar sampling, this means that the number of points will vary with the radius.

There are many other types of grid sampling method among which you have the **square-centered grid sampling** (Figure 5) and the **hexagonal grid sampling** (Figure 6). They all produce their own distribution and RMS values (13.214 µm for Figure 5 and 13.228 µm for Figure 6).

All the sampling methods that I have shown so far are based on periodic patterns which inevitably produce artefacts in their respective spot diagrams which are a sort of aliasing. This is particularly obvious here in the polar grid sampling of Figure 4 which produced concentric rings but you can also notice patterns in square and square-centered sampling in Figure 3 and Figure 5. Only hexagonal grid sampling in Figure 6 does not seem to have patterns but this is not always the case.

As a general rule, remember that periodic patterns will produce artefacts in their spot diagrams distribution. The only way to avoid these artefacts is to avoid periodicity in the pupil sampling in a first place. Stochastic sampling is therefore introduced as a better way to sample the pupil.

However, randomly sampling points in the pupil does not give the best results. An improvement on the method is the **jittered grid sampling** (**dithered sampling** in ZEMAX) which consists of using a periodic grid, often square grid sampling, and to shift each point by a random amount. Although this is already an improvement over pure random sampling, it produces region of high and low point densities which will affect the computation of the RMS figure.

The best known algorithm to generate random uniform distributions if the **Poisson disk sampling** method for which an example is given in Figure 7. It generates high quality distributions but at the price of some computational cost. Here, I used the “Fast Poisson Disk Sampling in Arbitrary Dimensions” method of Robert Bridson which is relatively easy to implement and still has *O(N)* complexity. I obtained a RMS value of 13.114 µm for Figure 7.

I personally recommend using the Poisson disk sampling method for spot diagrams communication and RMS spot size computation for its robustness against aliasing artefacts.

The required density of the plots is a trickier question to answer. In this post, I have used 1,000 points for each analysis and it is difficult to come up with a recommended figure that will work in all optical designs. ZEMAX OpticStudio uses 6×6 rays by default in square grid sampling which is a bit low to my personal taste although it produces more readable plots for communication with clients. I would say that you can start with about 100 rays and increases the number until it converges to the precision you require (10%, 1%, 0.1% etc.). I think that using N=1,000 should work in almost all common cases at the price of some more computations compared to N=100.

It is worth noting that although this is a quantitative method, it only gives an estimation of the geometrical limitation of your system as it does not account diffractive effects. As a consequence, there is little added value to reaching highly accurate RMS values as this is only an approximation of your system performances.

When doing optical design, you can use RMS spot size as a tool to quickly *invalidate* a design rather than as a tool to *validate* your design. If the RMS test fails, you know the design will fail when you account for the diffraction effects too because diffraction will only make it worse. On the other hand, it is not because the RMS test passes that your design will still pass when you account for the diffraction effects. And since RMS spot size is relatively fast to compute, it can tell you early in your design if you need to change something.

RMS spot size is also a good tool to evaluate best focus position as aberrations will shift the transversal focus locus compared to the paraxial focus. You may also use RMS spot size plotted against field angle/position or wavelength to asses some of the performances of your design etc. So, it really is an extremely important tool when doing optical design and it is probably the first criteria an optical designer will check when doing its job.

In the next post, we will see how to account for diffraction and we will then dig the third-order aberration theory which will close the first part of design evaluation. I will probably then move to tolerance analysis although I should start discussing chromatic effects and glass selection at some point too.

I would like to give a big thanks to **James**, **Naif**, **Lilith**, **Cam**, **Samuel**, **Themulticaster**, **Sivaraman**, **Vaclav** and **Arif** who have supported this post through [∞] Patreon. I also take the occasion to invite you to donate through Patreon, even as little as $1. I cannot stress it more, you can really help me to post more content and make more experiments!

**You may also like:**

[»] #DevOptical Part 9: Geometrical Image Simulation

[»] #DevOptical Part 11: The Diffractive PSFs

[»] Custom 5x Plan Objective from Stock Elements