The Zemax Black Box surface solves the problem of how to share optical design data without revealing design secrets. This article explains how to export part or all of an optical design as a Zemax Black Box surface, and how to use that surface in subsequent optical design, optimization and analysis.
This article is also available in Japanese.
Authored By: Mark Nicholson
Introduction
This article is also available in Japanese.
The Zemax Black Box surface solves the problem of how to share optical design data without revealing design secrets. Sharing optical design data has previously presented many difficulties for optical designers and the organizations that employ them.
Although customers, suppliers, external consultants etc. may need to receive ray-traceable data files in order to perform their work, providing this data exposes the original designer's intellectual property. First order methods, like paraxial surfaces and ABCD matrices are fine for providing data like pupil sizes and locations, or image location and magnification, but do not provide any aberration data and so are not useful for designing subsequent or prior optical components.
Zernike surfaces allow aberration data to be defined for a single field point, wavelength and conjugate ratio and are described here. The Zemax black box, however, contains all the information needed to trace real rays at whatever field point, wavelength and conjugate is desired, exactly as if the original surfaces and design data were present in the Lens Data Editor. The detailed data is actually hidden inside the Black Box, and the user cannot review or modify any of the data contained within the hidden Black Box section. The data is encrypted using a 256-bit algorithm.
This article describes the creation and use of Black Box lens files.
Making a Black-Box Surface
Converting a design to a black box is usually done when the design is complete, although it can be done at any stage in the design cycle. We recommend that you add two extra dummy surfaces to define the first and last surfaces in the range of surfaces to export. These would usually be positioned at mechanical datums (any maybe represent the extent of the mechanical housing holding the optics, for example) or at pupil locations.
In this example (which can be downloaded from the link one the last page of this article), it is intended to export the final lenses in this double-Gauss objective. Dummy surfaces have been added to represent the mechanical housing that holds the lenses:

Prior to export, all surfaces in the intended range should have fixed apertures placed on them, because when we play the lens back Zemax needs to know the actual physical extents of each lens to compute vignetting. Tools...Apertures...Convert Semi-Diameters to Circular apertures is a useful tool. Any aperture type except the User Defined Aperture (UDA) can be used to define the mechanical extents of each lens within the exported region.
To create the Black Box file, select Tools...Export Data...Export Zemax Black Box Data:

It is recommended that you leave the option 'Create and load test file' checked, so that Zemax will not only create the black box file, but will also delete the surfaces in the specified range, load the black box, and save the file into a file with the name {original filename}_BB.zmx. This makes it easy to ensure that the black box file really does represent the exported file, and is an important quality assurance step. The new file will be automatically loaded:

and you can confirm that the ray-trace results are exactly the same between the original and black-box versions of the file.
Consequences to Using a Black Box Surface
There are some consequences inherent in the nature of a 'black box', some of which are obvious and some maybe not. Rays hit the front surface of a black box and emerge from the back surface exactly as if they had been ray-traced through the equivalent surfaces in the Lens Data Editor, but without exposing any of the surface data. Things that may or may not surprise you include:
- The data for all surfaces inside the black box is hidden, and therefore can not be accessed by analysis features, optimization operands or ZPL commands. You cannot for example tolerance a black box file, or perform thermal analysis. It is a black box and it cannot be altered once created. The surfaces outside the black box can of course be analyzed, optimized, toleranced etc. as normal.
- Ususally Zemax distinguishes between rays that hit apertures and are clipped, rays that totally internally reflect, and rays that miss a surface because there is no valid ray-surface intercept location, and gives different error codes for each case. When tracing a black box, all Zemax knows is that the ray went in but did not come out, and a 'Ray Miss' error is generated. Note that if the chief ray is not traceable (as in a telescope with a central obscuration, for example) wavefront calculations will not be possible as there is no chief-ray reference data.
- No ray data can be generated on any surface inside the black box, so so the Object, Stop and Image surfaces cannot be inside the black box. Zemax requires direct access to all the ray data on these three surfaces.
- Physical optics analysis is not appropriate for black-box optics, as only output ray data is available. FFT and Huygens PSF/MTF etc all work as normal.
- The range of surfaces exported may include Coordinate Breaks and surface tilts/decenters, but the first and last surfaces must be within the same coordinate system so that the input and output planes are only separated by a thickness.
- The thickness of the black box surface is reported in the Lens Data Editor, as it is needed for the placement of subsequent surfaces. This does not disclose any details of the internal design, it simply gives the distance between the input and output planes. Since the thickness cannot be changed, the black box must be played back in the same 'mirror space' as the original lens. Hence if the original design came after a mirror, so must the black box.