OpticStudio provides a built-in tool to generate a reduced-order model of the optical systems designed in OpticStudio for use in Speos, an Ansys software package used for rendering and visualization of comprehensive systems. The 'Export to Speos Lens System' tool, found in the File tab, creates a .OPTDistorion file that can be read into Speos as the reduced-order model. In this way, a lens system of a camera can be accurately simulated. This article guides us through the use of the tool and the loading of the resulting output file into a new Speos environment.
Authored By Kevin Scales
The ‘Export to Speos Lens System’ tool can be found in the Export group. The use of the tool will be described with an example from a cell phone lens. The loading of the resulting file into Speos will also be covered to exemplify the complete workflow.
Speos uses .OPTDistortion files to mimic complex lens designs with a single set of ray transformations that can be put into a Speos environment to model the effect of a camera lens design in a larger model environment. Of the available Sensor types in Speos, currently Camera sensors are supported. The cell phone camera lens, as described in the KBA article Designing Cell phone Camera Lenses Part 1: Optics will be the model used, based on the original formulation with Even Asphere surfaces, but with real glasses used rather than model glasses, which are unsupported by Speos and by the export tool.
In section 1, the process of converting OpticStudio to Speos using the OpticStudio tool will be described and shown.
In section 2, the process of loading the resulting .OPTDistortion into Speos will be described and shown. Users will need to have an active license for both OpticStudio and Speos to follow along in this step.
Questions about the conversion process can be directed to Zemax Support by opening a Support case.
Exporting to the Speos Lens System
The button to start the tool is found in the Export group under the Files tab.
Load the file from the attachments named "Cell Phone Camera.zar." It is a model of a camera phone lens.
Starting the exporter brings up the following dialogue box, including default inputs:
The values for # Radial Points and # of Rays are fixed defaults that the user can change at will. The above graphic shows as well the placement of the sampling points. For some complicated systems, the default ten points may be insufficient, so it is recommended to increase the sampling until no discernable change in the performance is observed. The Sensor Width and Height will default to a value in lens units equal to the Clear Semi-Diameter at the IMAGE surface multiplied by Sqrt(2). This is an estimate of a square sensor size that will give sufficient coverage in most cases.
After running the exporter and saving the output, the window will display the calculated parameters for each pupil location:
Click Exit to finish. Clicking OK will run the tool again.
The tool creates two files, one of which is the .OPTDistortion file used for Speos. A text file duplicating the converter tool's window output is also written and saved in the same folder as the .OPTDistortion file. The file contains information about the input rays and the resulting outputs. The format of the .OPTDistortion file is described in detail in the Speos Users Guide. Briefly, it contains a header with some information about the file, a comment line (currently outputting only the word 'comment'), followed by some information about the geometric system and physics, including coordinate system types for the ray direction and starting point, and emissive surface types. The sampling information is written. Finally, a remainder of the file contains lines of data for the individual rays' directions, starting point, emissivity, focus distance, and emissive surface. The Speos Lens System section of the Speos Guide contains the details of these quantities.
The conversion tool works by a process of reversing the lens system. Through this process, a temporary copy of the files, all variables are removed automatically from the editor and all values for the Radius, Thickness, Semi-Diameter, and Mechanical Semi-Diameter are set to Fixed. The Design Lockdown is then run to set inputs to those suitable for real manufacturing inputs. If there is a problem with the process of reversal, you will see a warning message displayed and the computations will be aborted. The check box to skip the reversal is available in this case, and you should manually reverse the system prior to running the tool. See the help page for Design Lockdown for details and explanations of this process.
At this point, the Thickness from the penultimate surface is copied to the Object Surface (#0) and the Reverse Elements tool is changed from Surface 1 to the penultimate surface and the final Image surface is removed. If no mistakes occurred in the conversion process, the system elements are now reversed. For fields, the current settings are removed, the type is set to Object Height, and a single field is set in X with the value set to the largest previous field value. The Object (Surface 0) is assigned as the Global Coordinate Reference surface if it is not already.
The use of the Speos Lens System Exporter is relatively straightforward in OpticStudio. It is now useful to verify in Speos that the resulting .OPTDistortion file loads and works correctly. A slight familiarity with Speos is assumed in the following section.
Loading a Speos Lens System into Speos
The .OPTDistortion file defines a Speos Lens System in the Speos software package. The lens system is the file. The attachments at the beginning of the article include the project file 'Speos Cell Phone Lens 1.scdocx', which has some of the basic settings pre-selected. There are three steps to take in Speos to show the use of the .OPTDistortion file. The first is to create a camera sensor located in the Light Simulation tab. After establishing an origin for the camera, the Definition window includes information on the Axis System, the Optics, and the Sensor characteristics. In the definition section of the camera is where the OPTDistortion file is used. The file must be selected in the Distortion field located in the Optics section. The panel should look like this:
Some of these settings are defaults. In the Optics section, the focal length and F-number is taken from the settings in OpticStudio for the cell phone lens. They are not strictly needed in the latest versions of Speos at the time of this writing. Likewise, the Imager distance is set to zero in the newest version.
The Transmittance as a function of wavelength is contained in a spectrum file, and a sample spectrum, Transmission.spectrum, is included in the attachment for this article. Sensors also have a sensitivity for three input channels of red, green, and blue. These sensitivities are also handled with .spectrum files, and the sample file has three loaded: Gaussian_red.spectrum, Gaussian_green.spectrum, and Gaussian_blue.spectrum. The Speos User Guide has more information about each of these options.
The Distortion field takes the name of the .OPTDistortion file created by the export tool, and this is the place to include it. The Sensor data is mostly chosen by user preference, and for this section the values shown are used. The values are not filled in automatically, nor does the Speos Lens System file contain this information. In our example, we want the given Width and Height values based on the camera lens, and the pixel counts are user-defined for the desired resolution of the system. These are the four fields the user in this example should consider.
Next, a Display is created and is used as the source. The display object is also located on the Light Simulation tab. The file Speos Cell Phone Lens 2.scdocx contains this step. Double clicking on the Display item brings up the Display definition panel, which looks like this:
As with the camera, some settings are simply default values. The X and Y range are set based on the size of the source image, which is Test Pattern.png. The Clear Semi-Diameter in OpticStudio for the OBJECT gives an idea of how to size this, and the convenient values of 600 and 450 mm are used here. Note that in the Axis system section, one direction is reversed while the other is not. This is to orient the source so it shines back at the camera.
The sensor and the source are the minimum physical objects needed to perform a simulation. The remaining step is to define the simulation methodology itself. Again on the Light Simulation tab, the Inverse simulation should be selected:
Double-click the Simulation to define the simulation parameters such as duration or number of passes. We select True for the former and False for the latter, followed by a duration of one minute.
After double-clicking on Simulation, the tool guide icons include items for selecting and verifying both sources and sensors. Until these are selected, the Simulation is not ready, and a message like this will appear by hovering over the Simulation:
Simply pick and validate the ones that have been defined now.
The attached file Speos Cell Phone Lens 3.scdocx has everything ready to go. To run the simulation, click the Compute tool guide icon. Upon completion of the simulation, the computed files will appear below the simulation tree.
The file of interest is the Irradiance map, which is now visible below the Simulation:
The result will look like this:
What we now see is the irradiance map in the imager plane. The original OpticStudio system has been simulated through the Speos Lens System. Speos can add additional imager processing that is beyond the scope of the Export tool, and is not covered here. The user may wish to run OpticStudio tools like Image Analysis for comparison of how the simulated images look to the viewer.
Zemax OpticStudio and Speos are both optical software packages in the Ansys family that work problems of optical modeling and visualization under different regimes, so the ability to share files between the two can increase the modeling power available to users of both. The Export to Speos Lens System tool allows for the use of OpticStudio to create optical systems for Speos to model cameras in a larger scenario. Prior to this tool, it took outside software to patch together a common framework, but now users of OpticStudio can create these inputs directly.