Analyzing hologram construction fringes with a ZOS-API User Analysis

This article is part of the Designing with Holograms free tutorial.

When designing an optical hologram, it is often important to analyze the fringe frequency on the element to ensure manufacturability. This article provides a User Analysis to allow such investigation into the sequential Hologram 1, Hologram 2, and Optically Fabricated Hologram surface types. The source code is also provided as a demonstration for creating User Analyses via the ZOS-API, as well as preparing the settings dialogue to allow for interactive customizability of the user analysis settings.

Authored By Zachary Derocher


Article Attachments


The tools available in sequential OpticStudio allow for hologram definition via interference of two construction beams. While the definitions are flexible, there is nothing preventing the user from simulating non-producible holograms with overly dense fringe patterns. This article presents ZOS-API Analysis for viewing the structure and density of the hologram fringes.

We provide the source code for the User Analysis as an example. This analysis makes use of the UserAnalysisSettings Mode; while not a complete walkthrough, this demonstrates how to initialize and retrieve values from a settings window in an API analysis.

Preparing and running the analysis

In order to run the analysis, download and unzip the article attachments. The solution file and relevant supplementary files (source, etc.) are available in the project folder. The executable user analysis file “Hologram Construction Interference.exe” should be saved to the directory …\Documents\Zemax\ZOS-API\User Analysis\. After the executable has been saved, OpticStudio should be closed and re-opened, and then the analysis "HologramFringes" will be available for use via The Programming Tab…User Analyses…Hologram Construction Interference.

Calculating the hologram fringe data

The interference data at any point on the hologram surface can be calculated based on the relative path lengths and the difference in the direction of energy propagation of rays emitted from the two construct sources towards that point. The user analysis is broken into 2 parts: first for the case of the Hologram 1 and 2 surfaces, and second for the case of the Optically Fabricated Hologram surface. The former uses a purely geometrical treatment, but the latter requires opening the construct files and performing real ray traces which consider the construct optics.

To calculate the fringe pattern in either the case of the Optically Fabricated Hologram or the Hologram 1 or 2 surface types, we can simply trace rays from the two constructs to the hologram surface and check their relative path lengths in order to find the interference pattern. In the user analysis, this computation is akin to an interferogram approach, based on the path length differentials.

As for the fringe density, this calculation is based on the difference in construct beam wave vectors (ray direction cosines) at a given point on the hologram surface, and the construct beam wavelengths. In free space, the interference looks like:

In this expression, Λ is one fringe spacing (inverse of density), ro and rr are the construct beam vectors, and f is the direction orthogonal to the fringe planes. This is shown here, where the red dotted lines represent the interference fringes in free space:

However, OpticStudio models holograms as thin-films; there can be no fringes anywhere except on the plane of the hologram surface. We can use the surface normal to take the surface profile into account:

Where f' lies in the plane of the thin film. So, σ is really the value that we care about: the spacing of fringes within the plane of the hologram surface. Taking the reciprocal of this value will yield the fringe density. Note that all of these calculations are purely local; we perform this calculation at a grid of points across the full hologram surface to determine the fringe density at any given position.

Calculating the hologram fringe frequency for Hologram 1, Hologram 2 surfaces

In the case of the Hologram 1 and 2 surfaces, the construct sources are defined as points in XYZ, with no optics intervening in the ray paths between the construct points and the hologram surface. So, for each point on the hologram surface, we can calculate the difference in the two source point ray vectors by a purely geometric treatment, without the need for tracing rays. In this case, for each sample point on the hologram surface, we draw a vector between the construct source and that point. This is done for both construct sources. We then use the difference between the two vectors, as well as the wavelength to determine the fringe frequency on the hologram surface.

Calculating the hologram fringe frequency for the Optically Fabricated Hologram

The case of the Optically Fabricated Hologram is a bit more complicated because their properties include the effects of aberrations resulting from two separate optical systems. When an OFH is the subject of the analysis, we must open each construct ZMX file individually (done the background using new instances of IOpticalSystem), and run a batch ray trace to retrieve the direction cosines of each ray in the grid at the hologram surface. From the ray trace, we also retrieve the surface normal vector at the given point, for use in the fringe density calculation.

The analysis settings

The hologram analysis presented here allows for the user to plot either fringe frequency (fringes per lens unit), or show the interference fringes of the construct beams directly on a normalized scale. The analysis settings are as follows:

  • Surface Number: the surface number for the hologram surface to be analyzed. Only valid surfaces are presented as options (Hologram 1, Hologram 2, Optically Fabricated Hologram). If no valid surfaces are found in the system, an error message will arise when the analysis is loaded.
  • Sampling: the sampling density for the grid of rays used to probe the interference. The actual number of sample rays traced is twice the value indicated here, since a grid of rays is necessary for both construct beams.
  • Fringe Scale: disabled and unused when “Plot Fringe Frequency” is enabled. When the analysis is set to plot interference, this scale factor determines the number of physical interference fringes per plotted fringe. For example, a value of 10 means that for every fringe seen in the plot, 10 physical fringes are present in the hologram surface. For high-power holograms, extremely high sampling may be required to view the full fringe pattern and avoid aliasing effects. Increasing this scale factor allows removal of aliasing effects while keeping the sampling relatively low.
  • Plot Fringe Frequency: determines which mode in which the analysis is run. When checked, the analysis presents the fringe frequency (fringes/lens unit). When unchecked, the analysis presents the fringe pattern, with normalized units.
  • Save Text Data: allows the user to optionally save the calculated raw data as a text file. The file is saved to the same directory as the current lens file. The text file name entered here should have no path, and end with the extension “.txt” (i.e. “analysis.txt”).

Programming the User Analysis settings in the API

When the user analysis is opened, the executable file gets called in the UserAnalysis mode, meaning that we simply call the RunUserAnalysis() function and then end. In this case, the default settings defined in the RunUserAnalysis() function are used. After the analysis has loaded, the user can then open the analysis settings from the UI to choose custom options.

In the UI, the settings dialogue for a ZOS-API User Analysis is initialized just like any other analysis window: from the “settings” drop-down at the top-left corner of the window. This button initializes the user analysis .exe file, but calls it with a different Mode flag, such that instead of the RunUserAnalysis function, the ShowUserAnalysisSettings function is called. In the attached source code, this secondary function can be found near the bottom of the file. In this function, we initialize a new settings form. In Visual Studio, the settings form can be seen by right-clicking and selecting “Open” on AnalysisSettingsForm.cs in the Solution Explorer:

Here, we can see all the settings defined (buttons, combo-boxes, etc.). By clicking on an individual button, we can see in the properties for that setting in the Properties pane, including its name, type, and other information. You can introduce additional settings entities to the form from here as well.

These settings are actually utilized in the code by calling the AnalysisSettingsForm() function. The definition of the settings form can be seen by right-clicking on the AnalysisSettingsForm() function and selecting “go to definition”. From there, we can see a few components present in the settings form:

  • The AnalysisSettingsForm_Load() function is called when the settings window is first loaded up. Here, we populate the options given to the user, and populate default or previously-selected values in each field in the settings form.

  • The b_OK_Click() function is called when the “OK” button is clicked in the settings. This is when we actually utilize the settings chosen by the user. We assign the settings to global variables, and then the RunUserAnalysis() function is called, which will retrieve the values from those global settings variables.

  • Other functions are defined to allow the user to interact with the other settings fields.

Once the OK button is clicked on the settings window, back the ShowUserAnalysisSettings() function of Program.cs we retrieve the settings values using the API’s SetIntegerValue(), SetDoubleValue(), etc. functions. Finally, we call the RunUserAnalysis() function to recompute the analysis using the those desired settings. In the RunUserAnalysis() function, it can be seen that one of the first actions taken is to set some default settings values, but then check if the settings window has been called previously. If so, we instead retrieve the user settings via the GetDoubleValue(), GetIntegerValue(), etc. functions. This completes the communication between the settings dialogue and the computation of the user analysis.

Assumptions made in the hologram analysis

  • The clear aperture of the hologram surface is assumed to be circular, and is defined by the Clear Semi-Diameter cell of the LDE (hard-apertures defined in Surface Properties > Aperture are ignored). In the case of Optically Fabricated Holograms, this is still true, and the hologram size is determined by the Clear Semi-Diameter of the playback hologram surface. It is recommended to use the “Floating Aperture” or “None” aperture types for the hologram surface, to avoid confusion.

  • For Optically Fabricated Holograms, it is assumed that the system units are the same in all three files (the two construct files, and the playback file),

  • The analysis is valid for curved hologram surfaces; the results are calculated on the curved hologram plane. For all hologram types, in the fringe density calculation the fringe spacing is calculated in the local tangent plane of the hologram surface at the sample point; in the interferogram view, the path lengths from the construct points are calculated based on the path length to the actual surface coordinate (including sag). However, because the results are projected into 2D data grid, care must be used when analyzing output. In particular, for hologram 1 and 2, the grid of rays is equally spaced over the clear semi-diameter of the surface. For the Optically Fabricated Hologram, the rays are equally spaced in the pupil. Also note that the analysis is currently only valid for conic hologram substrate shapes. In other words, the complex surface sag options in the Optically Fabricated Hologram aren’t supported (the “Shape” parameter of the Optically Fabricated Hologram must be 0).

  • For Optically Fabricated Holograms, the geometry of the playback hologram must precisely match the geometry of the STOP surfaces in the construct files.

  • Mirrors are supported in construct files. If the STOP of a construct file for the Optically Fabricated Hologram is in mirror space (rays have reflected from an odd number of mirrors), then rays are considered to be incident upon the “front” of the STOP (even though they’re propagating along -z).



1. Welford, W. T. Aberrations of the symmetrical optical system Aberrations of optical systems. A. Hilger, Bristol ; Boston, 1986.

2. Welford, W. T. “A Vector Raytracing Equation for Hologram Lenses of Arbitrary Shape.” Optics Communications, vol. 14, no. 3, 1975, pp. 322–323., doi:10.1016/0030-4018(75)90327-2.


Was this article helpful?
1 out of 2 found this helpful



Please sign in to leave a comment.