How to use Ray Aiming

To handle aberration or displacement of the pupil, OpticStudio includes options in the Ray Aiming section of the System Explorer to improve analysis by aiming rays to fully fill the stop surface. This article will work through two examples to discuss the steps for determining if Ray Aiming is necessary and the benefits of utilizing the setting.

Authored By Nam-Hyong Kim


Article Attachments


Ray Aiming is an iterative ray tracing algorithm in OpticStudio that finds rays in object space that correctly fill the stop surface for a given stop size. It is generally only required when the pupil (the image of the stop as seen from the object space) is considerably aberrated or shifted/tilted.

Without Ray Aiming, real rays from the object are aimed at the paraxial entrance pupil, the location and size of which can be found in the Prescription Data report. In many cases, aiming at the entrance pupil will not adversely affect the system. The user should investigate so that they only use Ray Aiming when necessary!

Pupil Aberration Fan

To find out if a system has significant pupil aberration, use the Pupil Aberration Fan under Analyze...Aberrations...Pupil Aberration. As a rule of thumb, if the maximum pupil aberration is more than a few percent, Ray Aiming is probably required.

The following images show the pupil aberration plot for a system known to have significant pupil aberration. The graphs plot pupil distortion as a function of pupil coordinate. The first image shows the Pupil Aberration Fan with Ray Aiming off and the second image shows the difference in the Pupil Aberration Fan for the same system with Ray Aiming on (Paraxial).



Example with moderate pupil aberration

Open the Double Gauss 28 degree field.zmx sample file in {Zemax}/Samples/Sequential/Objectives folder.


Let’s suppose that this file represents a camera lens in which the stop semi-diameter is known to be exactly 10 lens units. In that case, the system aperture should be defined as Float by Stop Size. This means that the Clear Semi-Diameter value in the Lens Data Editor will determine the size of the system aperture; a proper choice when the size of the stop is known.

Navigate to System Explorer...Aperture...Aperture Type and set the system aperture to Float By Stop Size.


In the Lens Data Editor, set the stop Clear Semi-Diameter to 10 lens units.


If you zoom in close to the edge of the stop surface in the layout, you can see that the marginal rays do not land exactly on the edge of the stop.


This is because without Ray Aiming, the rays from the object's space are aimed at the entrance pupil - the paraxial image of the stop as seen from the object space. The paraxial calculation for entrance pupil size and position only considers the power of the optics between the object and the stop surface, not the aberration. You can check out "Understanding paraxial ray tracing" for more information on paraxial calculations. 

Ideally, when ray tracing, only rays that land on the correct stop coordinates should be chosen to properly sample the system aperture. In fact, marginal rays are defined as those that intersect the edge of the stop, so the rays in our analysis should adhere to this definition.

With the change to the Aperture setting, the resulting pupil aberration plot shows a maximum value of 3% with Ray Aiming off, indicating that Ray Aiming may not be necessary in this case. Users should always consider the tradeoff between the increased ray trace accuracy vs. computational time when using Ray Aiming is questionable. In general, Ray Aiming will decrease the ray trace speed roughly by factor of 2 to 8. 


Now, let’s turn the Ray Aiming to Paraxial and observe the change in the layout. We do this by opening Ray Aiming in the System Explorer and choosing Paraxial in the drop-down menu. By default the Use Ray Aiming Cache option is checked and the Robust Ray Aiming option unchecked. These settings should not be modified as they are rarely needed. For more information about these setting, please refer to the Help System.


The Ray Aiming algorithm iteratively finds the rays in object space that will yield the desired stop surface coordinate. The layout shows all marginal rays intersecting the exact stop semi-diameter. It is important to note that Ray Aiming does not remove the pupil aberration; the aberrations are still present, but they are accounted for when choosing the input rays to sample. 


Example with significant pupil aberration

The above example was one in which the aberration was small enough that using no Ray Aiming would not significantly affect the results. Now, we turn to an example in which Ray Aiming must be used. Open the included sample file and navigate to System Explorer...Ray Aiming to ensure that Ray Aiming is Off. 


You will notice that all the rays from the object space, i.e. before surface #4, are aimed at the paraxial entrance pupil. According to the Prescription Data, the entrance pupil position is in surface #1 coordinate system; hence, in this example, it is 1.82915 lens unit (mm for this file) right of surface #1.


The Clear Semi-Diameter of the stop surface has been set to allow real marginal rays from all fields and wavelengths to pass the stop. Yet, with Ray Aiming off, none of the rays from field #3 can even reach the stop surface. In Sequential mode, rays must be able to travel through each consecutive surface, if they are unable to do so they are terminated. Field #3's rays have an awkward incident angle that does not allow them to even hit the first surface.

In this file, the Aperture Type is set as Entrance Pupil Diameter. Since the Float By Stop Size Aperture Type is not selected, the first thing we will need to do is determine the size of the stop so that OpticStudio can properly aim the rays. With Paraxial Ray Aiming, the size of the stop that the rays are aimed at is determined by the paraxial marginal ray height at the stop surface. To find this value, even without Ray Aiming, open the Single Ray Trace analysis feature under Analyze...Rays & Spots...Single Ray Trace. Expand the feature settings and choose Field 1 and Pupil Coordinates to Px=0 and Py=1 (the on-axis marginal ray).


Under the Paraxial Ray Trace Data, the Y-height at the stop (surface #12) is reported as being 0.424804 and - under the Real Ray Trace Data - 0.432259. This difference between the real and paraxial marginal ray height is much larger for field #2 as evident from the ray trace calculation and the 2D layout above.


Now, let’s turn the Ray Aiming to Paraxial. The difference between the real and paraxial Y marginal ray coordinate at the stop surface is practically zero for all fields and wavelengths. We can confirm this in the Single Ray Trace calculation.


As mentioned previously, with Ray Aiming set to Paraxial, the real marginal ray intercepts the paraxial stop surface height. For any system, the user may specify the size of the the stop they want the ray to fill. If that is preferred, the Aperture Type should be set to Float By Stop Size and the Clear Semi-Diameter values entered manually - just like in the previous Double Gauss example.

For moderately aberrated systems, the stop size determined using paraxial rays will generally be slightly different than one determined using real rays. However, it is usually the case that the difference between these two is small enough that it need not be considered. Nonetheless, Ray Aiming may be performed using real rays rather than paraxial to calculate the stop height if preferred. Generally, though, it is easier to simply set the Aperture Type to Float By Stop Size in order to manually specify where the real rays should be aimed at. In order to know that setting will be most beneficial to your system, please consult the OpticStudio Help Files carefully before using aberrated Ray Aiming option. Please also note that the Real Ray Aiming option should not be considered superior to the Paraxial Ray Aiming in all cases. 

Decentered Stop

The paraxial ray calculation, used to calculate the entrance pupil size and position, ignores tilt and decenter of surfaces, including the stop. This means that the vertex of the paraxial entrance pupil is always located along the local Z axis of the object surface. If the stop surface is significantly decentered and/or tilted with respect to the paraxial entrance pupil, Ray Aiming might be needed, even with no optics between the object and stop. See the example in the following diagrams.



Turn Ray Aiming on if the stop is decentered with respect to the optical axis (e.g. the Z-axis of the object surface).


Was this article helpful?
7 out of 7 found this helpful



Please sign in to leave a comment.