# What is the Pupil Shift and how is it calculated?

This article defines the Pupil Shift and explains how to interpret the ray aiming option "Automatic Calculation of Pupil Shifts". The explanation is accompanied by a sample archive file, provided as an article attachment.

Authored By Alessandra Croce

Article Attachments

## Introduction

When a Sequential system features a particularly aberrated or shifted pupil, it may be difficult for OpticStudio to find the stop surface. Very occasionally in this case, you will receive an error message stating "Cannot determine object coordinates". To avoid this error, the "Pupil Shift" option under Ray Aiming in the System Explorer can be used to help the Sequential ray tracing algorithm find the general location of the stop surface.

In this article, we will work through an example to show how to manually set up the Pupil Shift, and how to use the "Automatically Calculate Pupil Shifts" option.

## What is the Pupil Shift?

The article How to use Ray Aiming algorithm is robust and can correctly aim rays for most aberrated and/or decentered/tilted pupils. However, it needs to first find a ray that reaches the stop surface in order to iteratively find the desired stop coordinate.  By default, the first guess is the center of the paraxial entrance pupil and launches rays in that direction. If the ray from the first guess does not reach the stop surface, it then attempts to find the stop surface by launching rays in different direction around the paraxial entrance pupil.  However, for extremely decentered/tilted and/or aberrated pupil the ray aiming will fail if it cannot find any ray that finds the stop surface. When this happens, OpticStudio will issue an error message as shown in the picture.

When ray aiming fails because of this (which is rare), ray aiming algorithm needs to be helped in finding a better first guess. The Pupil Shift specified in the System Explorer under Ray Aiming (when Automatically Calculate Pupil Shifts is un-checked) is the measure of how much the initial guess XYZ coordinate should be shifted by, from the default (paraxial entrance pupil position). The pupil shift needs only be precise enough to help the algorithm find the stop surface. Once OpticStudio has successfully traced a ray it needs no further help.

When turning ray aiming on, “Automatically Calculate Pupil Shifts” will be checked by default. OpticStudio will automatically calculate the difference in position between the paraxial entrance pupil and the stop, providing a better first guess for the ray aiming algorithm.

The example below will show how to manually calculate the pupil shift. This is no different in principle on how the automatic calculation of pupil shifts is done in OpticStudio.

## Manual calculation of the pupil shift

Here is an example on how to manually calculate the pupil shift. Open the attached file and follow the steps below.

Step 1: With ray aiming off, find out the Z location of the paraxial entrance pupil via the Prescription Data (found under Analyze...Reports...Prescription Data). The Z entrance pupil position in the Prescription Data is relative to Surface 1.

In the present file Surface 1 is also the Global Coordinate Reference Surface, so the coordinate reported in the 3D layout window is referenced to Surface 1, just like the entrance pupil position in the Prescription Report.
This can be seen in the Type tab of the Properties of Surface 1:

Step 2: In the 3D layout ensure the rotation is set to X = Y = Z = 0 (default).

Step 3: Using the cursor over the 3D layout, estimate the YZ coordinate that, when aimed at from the object, will let the real ray reach the vertex of the stop or close to it. Do not worry about being precise.

Step 4: Repeat the step 3 to determine the X coordinate with the Z rotation of the 3D layout set to +90, if the stop is also shifted in the X direction with respect to the paraxial entrance pupil (not for this sample file).

Step 5: Set the ray aiming to Real, un-check Automatically Calculate Pupil Shifts and enter the estimated X Y and Z (Z estimated – Z entrance pupil) values:

X= 0, Y = +30 and Z = 30.08 – 30 (close to zero so Z = 0)

Note that if you use ray aiming without specifying any pupil shift, you will get the “Cannot determine object coordinates!” error as mentioned in the beginning of the article.

After entering the pupil shift, the ray aiming algorithm locates correctly the stop and traces the rays needed to fill the stop.

## Comments on the automatic calculation of pupil shifts

The example above is only to demonstrate how pupil shifts can be calculated. The option “Automatically Calculate Pupil Shifts” will automate this calculation and is used by default when turning on both Paraxial and Real Ray Aiming. For this reason, XYZ Pupil Shift coordinates are hidden when “Automatically Calculate Pupil Shifts” is checked.

However the “Automatically Calculate Pupil Shifts” option can be un-checked, allowing the user to input a different pupil shift if needed.

KA-01452