# Paraxial vs. Real pupils in optical system

This article discusses the paraxial entrance pupil in OpticStudio, and the new features of the real entrance pupil and exit pupil visualization added in 2024R1. We will explain how they are calculated, along with usage notes. Additionally, this article introduces several use cases.

Authored By Kensuke Hiraka and Michael Cheng

Article attachment

## Paraxial pupils in OpticStudio

In this section, we will explain paraxial entrance pupil. A pupil is defined as the image of the system’s aperture stop, which is itself defined as the aperture that limits the rays reaching the image. The entrance pupil is the image of the stop seen when looking into the lens from the object space. The image of the stop seen when looking into the lens from the image space is the exit pupil.

The entrance pupil is a virtual image created by the system in front of the stop, and is different from the stop position and size. The position and size of the entrance pupil in a given optical system is shown in Figure 1.

Fig. 1 The position and size of the entrance pupil

The chief ray is defined by the ray from a point in object space that passes through the center of the stop, and the marginal ray is the ray that passes through the edge of the stop. The position of the entrance pupil is determined by where the chief ray of an off-axis object point intersects the optical axis when extending the chief ray straightly from object space, ignoring refraction by the lens, as shown as the red dashed line in Figure 1. The size of the entrance pupil is determined by extending the marginal ray, ignoring refraction by the lens, and finding the interception point on the entrance pupil plane. The entrance pupil shown in Figure 1 is a paraxial entrance pupil. The paraxial entrance pupil is calculated based on the paraxial ray tracing. For information on paraxial ray tracing, see the article "Understanding paraxial ray tracing". See also the article "Display pupils on a layout plot" which describes how to display pupils on a layout. In this article, we use a dummy surface and ZPL solve to display the entrance and exit pupils, but with the new feature added in 2024R1, we can display them by simply checking "Draw Paraxial Pupils" in the 3D Layout settings.

We can demonstrate using theZemax sample file "Double Gauss 28 degree field.zmx". Display the 3D Layout and check "Draw Paraxial Pupils" in the settings.

Fig. 2 3D Layout setting

Then we can see the entrance and exit pupils on the 3D Layout.

Fig. 3 Displaying paraxial pupils in 3D Layout

We can check the position and size of the entrance and exit pupils in the Prescription Data.

Fig. 4 Prescription Date

The entrance pupil position shown here is the position with respect to the first surface, and the exit pupil position is relative to the image surface. By checking the option, entrance and exit pupils are displayed with corresponding position and size 3D Layout. Thus, "Draw Paraxial Pupils" makes it easy to check the position and size of the pupils on the layout.

## Real pupils in OpticStudio

In this section, we will describe the concepts of the algorithms used in the real pupil visualization feature and how to use this tool. The real pupil displayed by this tool is determined from the focus position, in object or image space, of the rays emitted from the center and the edge of a STOP Surface. Figure 5 shows the focal position, in object space, of the rays emitted from the center of the STOP Surface.

Fig.5 Focal Point of the rays from the center of STOP Surface

When calculating the focal point for a given point on the stop surface, 9 rays are emitted from the given point on the STOP Surface. The direction of each ray is calculated by adjusting the normalized field of view coordinates Hx and Hy, by ±0.001 or ±0.000707, as shown in Figure 6.

Fig.6 Direction of rays

The same calculation is also done for the edge of the STOP surface with up to 32 sampling points. The focusing position of these rays from the center of the STOP surface  and the edge of the STOP surface are the position and size of the real pupil. This is how the algorithm works behind this tool.

From here, we will explain how to use the pupil visualization tool. To use this tool, select the number in "Draw Real Entrance Pupil" and "Draw Real Exit Pupil" in the 3D layout settings. This is the number of points sampled on the circumference for calculating the real pupil.

Fig.7 Real Pupil setting in 3D Layout

Ray Aiming must be used to use this tool. If Ray Aiming is "Off", an error message "Field dependent pupil calculation requires Ray Aiming" will be displayed on the 3D Layout and the layout will not be displayed. The Figure 8 shows a 3D Layout when the Ray Aiming in the sample file "Double Gauss 28 degree field.zmx" is set to "Real" and "Draw Real Entrance Pupil" is set to 32.

Fig.8 Entrance pupil of Double Gaussian 28 degree field

In this sample file, three Fields are set, so three real entrance pupils for each Field are displayed. The center position and outer diameter of the entrance pupil are displayed on the layout. Although the paraxial pupil is flat, the shape of the real pupil is not, as shown in Figure 9. Therefore, there will be a deviation between the center position and the outer diameter position of the real pupil displayed in the 3D Layout.

Fig.9 Center position and outer diameter of Pupil

So far, we have explained the paraxial pupil and real pupil visualization feature. Now let's check the changes in pupil position and size when the Stop position is changed in the simple optical system shown in Figure 10.

Fig.10 Optical system of two lenses with the Stop in the center

When the paraxial and real pupils are displayed, it looks like Figure 11.

Fig.11 Entrance and Exit pupils

Now change the aperture position as shown in Figure 12. The total length of the optical system is the same.

Fig.12 Change Stop position

Then, the pupil position and size change as shown in Figure 13.

Fig.13 Entrance and Exit pupils after changing the Stop position

Thus, even when the lens and Stop size are the same, the pupil position and size still change when changing the Stop position, which affects the optical system performance. Remember that the pupils are virtual images of the stop, and changing the stop position is analogous to changing the object distance. We can now see that pupil information can be important in optical design. In the next section, we will explain how to improve an optical system by checking the pupil information.

## Demonstration

In this section we introduce a simple case to demonstrate the pupil visualization feature. Here, we consider the case of connecting multiple optical systems. First, to the imaging lens shown in Figure 14, we will check the position and size of the pupil, add a single field lens, and optimize the field lens to ensure beams can properly propagate to the next optical system. The model here is "First lens.zar" in the attached file.

Fig.14 First lens

The next optical system where beams will propagate to is shown in Figure 15. The entrance pupil of the second system is supposed to be the exit pupil of the first system. In real case, this may mean an optical system with an ND filter, or a relay lens at the pupil, such as a microscope. The attached file "Second lens.zar" is the next optical system we will examine.

Fig.15 Second lens

When these two optical systems are connected, the result is as shown in Figure 16. The rays from Field 2 are not entering the second optical system. This is not an appropriate optical system.

Fig.16 Two optical systems connected

This is because the exit pupil of the first optical system and the entrance pupil of the second optical system are not properly overlapped. If we check the real exit pupil of the first optical system, we can see that it is inside the lens (Figure 17).

Fig.17 Real exit pupil of first lens

On the other hand, the real entrance pupil of the second optical system is surface 1 as the STOP. In other words, the positions of the real exit pupil of the first optical system and the real entrance pupil of the second optical system are significantly different. We need to add one lens between the two optics to bring the first lens' real exit pupil position closer to the second lens' real entrance pupil position to improve the optics so it functions properly.

To improve it, we first add a plate at the Image surface position of the first lens system. The Image surface position, after adding the lens, should be the position of the second lens (Figure 18).

Fig.18 Add the lens after first lens

The next step is to set the Merit Function for optimization as shown in Figure 19. The operand REAY constrains the marginal ray of each field to be less than or equal to the real entrance pupil size (lens radius) of the second lens (lines 1 to 6). We also constrain the principal ray of field 2 to be on the optical axis (line 8) and constrain the thickness of the added lens to be within 3 mm (line 9).

Fig.19 Merit Function setting

The result of optimization as well as the variables set is shown in Figure 20. We can see that the real exit pupil positions are close to the Image surface position.

Fig.20 After optimization

If we insert the second optical system to this optimized first optical system, we get the result shown in Figure 21. We can see that the optics have been improved and the rays are arriving at the Image Surface properly.

Fig.21 Two optical systems reconnected

In this way, we can design an appropriate optical relay system by checking the entrance and exit pupils of the optical system using the pupil visualization function tool.

## Tips and Cautions

In this section, some potential questions and answers are discussed.

### Coordinate Break not supported at 2024R1

The first version of the feature will not support the Coordinate break surface. This is planned to be relieved in a 2024R1.2.

### Comparison to paraxial pupils

It is interesting to compare the results between paraxial and real pupils. The following shows both types of pupils for the built-in ‘Double Gauss 28 degree system’. It can be seen that the “rings” have significant differences and the center point is nearly the same but still has a difference of a few microns. This is mainly because the two pupils are calculated in different way. The paraxial pupil is calculated using paraxial optics, in which all surfaces are assumed to be planar with a given optical power. However, the rea pupils are calculated by tracing real rays and finding the focus as discussed in the pervious section. The difference at the center is very small because it is only based on how the rays are chosen (1~2 rays in y direction for paraxial pupil and 9 perturbing rays for real pupil). The difference at the rings (the pupil edge) consider the distortion by considering the sub-system where the (STOP, Real Entrance Pupil) in original system is (Object, Image) in new system.

(\Documents\Zemax\Samples\Sequential\Objectives\Double Gauss 28 degree field.zmx)

### Affected by field type

As explained in the previous section, the real pupil is calculated by perturbing rays in normalized field coordinate (hx,hy), the calculated real pupil positions can slightly change when users switch between different field type even when the defined field points are equivalent between before and after the conversion. A good example can be found in \Documents\Zemax\Samples\Sequential\Image Simulation\Example 1, A singlet eyepiece.zmx. The following result shows how the result looks different between Field Object Height and Real Image Height.

### Telecentric systems

For a telecentric or quasi-telecentric system, their pupils are assumed to be either at infinity or very far away. This can make the calculation unstable and noisy for real pupils. OpticStudio tries to detect and report errors when the real pupil cannot be stably calculated. However, there are some telecentric cases that are not automatically caught and result in unusual drawing in the layout. Usually for these cases, we can check the paraxial pupil to understand whether the real pupils data can be problematic.

For example, if we open the following built-in example, turn on Ray-Aiming, and show the real exit pupil, we can find they are drawn unusually.

\Documents\Zemax\Samples\Sequential\Miscellaneous\ Telecentric system.zmx

If we checked the paraxial pupil, it becomes understandable because it suggested the pupil should be at infinity. As shown below, the data of paraxial exit pupil is 1e10 in the Prescription Data and in the layout the system is almost invisible because the paraxial exit pupil is too large.

For an experiment, we can try to slightly change the system so it’s no longer telecentric. As shown below, we set the distance between STOP and the paraxial lens to 90 and can observe both paraxial and real pupils are drawn at very closed position in the layout now.

### Distortion in real pupils

Since there is an imaging relationship between stop and real pupils, it’s not surprising to see that real pupils have distortion. The algorithm to find the real pupil position is based on searching the nearest 3D point that is mutually closet to the perturbing rays (Line–line intersection - Wikipedia), so the real pupils won’t be a plane. For many normal systems, since they are usually not designed to have a good imaging quality between STOP and pupils, the real pupils could be very distorted.

Here let’s have a look at the built-in sample “\Documents\Zemax\Samples\Sequential\Objectives\Wide angle lens 210 degree field.zmx”. In this example, by setting more fields, we can observe some very distorted real exit pupils.

To investigate more about this distortion, it would be useful to build up this imaging system that considers the original stop as new object and the original image surface as new stop. As shown below, we also added a Paraxial surface to form the image to understand how the image quality looks like when the new stop is at different position on the original image surface. It’s not difficult to observe, when the new stop surface is at a different position on the original image surface, that the image of the stop (exit pupil) has a strong defocus at edge of the stop (exit pupil). The system is attached as “distorted_pupil_in_wide_210.zar”.

In the figure below we see another way to observe the distortion without using the Paraxial surface. Instead, we extend the rays on the image surface to two sides of the system and overlap onto one of the distorted real exit pupils.

### Paraxial pupils in off-axis systems may not be useful

It’s suggested to use real pupils when the optical is off-axis. For example, we can open the following example and observe the paraxial and real exit pupils.

\Documents\Zemax\Samples\Sequential\Tilted systems & prisms\Lens pivoted about a point.zmx

It can be seen, since the lens in this system is tilted, that the real exit pupil position is slightly deviated, while the paraxial exit pupil is not affected. This is because the paraxial pupils are based on paraxial data (operands EXPP/EXPD) that doesn’t fully consider the lens tilt.

The other example is \Documents\Zemax\Samples\Sequential\Image Simulation\Example 6, tilted image plane.zmx

If we open this example, we will see the paraxial exit pupil is at a weird position, while the real exit pupil is at the right position.

This is because the paraxial exit pupil is always calculated on the local coordinate of the image surface. It’s always assumed on the local xy plane. In this case, the system is off-axis and it’s suggested to use real pupils.

## Reference

1. 渋谷眞人. "レンズ光学入門." アドコム・メディア (2009).