The goal of this example is to study the stray light of a smartphone camera system. Stray light is unwanted scattered or specular light at the camera sensor, which is unintended in the optical design and degrades the optical performance of the camera system.
[[NOTES:]] Software Prerequisites
To be able to use this Example, the following tools and assets need to be installed on your computer:
- Ansys Speos 2022 R2 or later + Zemax Importer Tool
- Ansys Zemax OpticStudio 22.2
Overview
Understand the simulation workflow and key results
In this example, the optical lens system is designed with Ansys Zemax OpticStudio (ZOS) and imported in one click to Speos using the new “Zemax Importer” tool for system level stray light analysis. The optomechanical components and lens edges used in this project can be designed in a CAD platform and later modified in Ansys Speos.
This example mainly covers the Speos part of the overall workflow, introduces stray light analysis concepts and demonstrates Speos features (Zemax Importer, light expert (LXP) and sequence detection).
Shown above is a typical workflow for the analysis of stray light in a camera system when using Ansys tools. The workflow can be split into four parts:
- Import ZOS lens design to Speos using the “Zemax Importer” tool.
- Detection of all possible critical sun positions and light leakage for the complete system.
- Stray light simulation of four sun positions within the camera FOV (Optional).
- Analyzing the stray light path sequences and mitigate ghost stray light for one sun position.
Step 1: Import OS lens design to Speos using the “Zemax Importer” tool
In the first step we use the “Zemax Importer Tool” to import the ZOS lens design into Speos.
Here we use a compact and efficient lens system for mobile phone cameras designed with ZOS.
By using the ZOS API, the tool can read the ZOS lens data parameters and recreate automatically each lens based on their mathematical representation as a native CAD geometry based on the Speos projection lens feature with access to all lens parameters.
Furthermore, the tool converts the ZOS materials into a Speos material format and applies the optical properties on the lenses.
The imager is converted into an irradiance sensor. The reference, origin for all the geometries and irradiance sensor corresponds to the position of the image plane.
In the final step we add the lens system to the optomechanical parts (grey) and lens edges (yellow), which are already predefined in Speos.
Step 2: Detection of all possible critical sun positions and light leakage for the complete system
In the second step, we study all possible critical sun positions in one simulation using a reverse ray-tracing simulation approach. It is powerful method that sends rays from the imager through the camera system to the sky. With this approach we can also detect light leakage in the mechanical system. The Speos ray tracing algorithm is taking all material behaviors of all geometries into account. Furthermore, we will categorize these areas by criticality and ray paths inside and outside of the camera FOV.
Light sources within the cameras FOV can undergo multiple secondary reflections at lens surfaces which leads to ghost reflections, lens flare on the imager.
Light sources outside of the FOV could cause stray light scattering on mechanical and optical parts.
By utilizing the Speos light expert (LXP) capabilities we can visualize and export these ray paths for a specific area on the intensity result.
Step 3: Stray light simulation of four sun positions within the camera FOV (Optional)
In this step, we run a full system stray light simulation for four different sun positions (from 0° to 15°) within the camera FOV. The simulation is run using Speos GPU.
Step 4: Analyzing the stray light path sequences and mitigate ghost stray light for one sun position
In step 4 we will identify the most critical ray path sequences (in terms of irradiance hitting the sensor) and object interactions leading to the stray light on the imager for the 5° sun position by utilizing Speos LXP and “Sequence Detection” features. In addition, we will show how to solve bright ghost stray light.
Run and Results
Instructions for running the model and discussion of key results
The following steps guide you through the workflow on how to analyze stray light of a smartphone camera system by using Speos capabilities:
Step 1: Import ZOS lens design to Speos using the “Zemax Importer” tool
First, we convert the ZOS lens design to a Speos project and prepare it for it for the simulation before importing it to the optomechanical system.
- Download the Zemax Importer tool from this link and install the tool according to the documentation.
- Start Ansys Speos 2022 R2 and open the “Zemax Import Template.scdocx“ project (located “\ZOS\”). The project includes two predefined irradiance sensors representing the imager. One sensor is separated by layer "Source”, which we will use for the simulation of the four sun positions and the other sensor is separated by layer “Sequence”, which is used to identify the critical ray path sequences.
-
Click on the “Zemax Import" tool in the “Assembly” ribbon:
- Navigate to the following folder “\ZOS\” and select the ZOS project file “Lens @hyperfocal.zmx”.
- In the pop-up window about the mechanical parameters click “yes” to consider the mechanical lens parameters. The tool is calling the ZOS API and extracting the lens data parameters, material and imager information and translate it into Speos features.
- Once the conversion is done, close the window . Press “B” on your keyboard to bring the project into the 3D mode. Then delete projection lens feature “Standard. 1” from the Speos design tree as the IR window is already setup in the final camera system. Delete also the BK7 material and the “Imager” sensor from the Speos panel.
- Apply a local meshing to all optical geometries. Additional information about the meshing can be found in the “Important Speos Model Settings” section.
-
Tip: For easier material identification you can apply visualization colors to the materials (Optional).
- Now save the project “Lens @hyperfocal.scdocx” in the following folder: “\ZOS\” and close the project.
- As a next step, we import the Speos lens system to the final project, where we have set up the optomechanical components and simulations. Open the “Stray Light Analysis - Smartphone Camera.scdocx“ project (located “\Speos\”).
- In the Assembly, tab click on “File” and import the “Lens @hyperfocal.scdocx” file.
-
The direct simulations for step 2-4 have to be set up as follows:
-
To visualize all ray paths in the 3D view for a specific area in the result, activate the LXP in the Sensor tab of simulation “SLA 5° sun positions LXP”:
-
Run the following three simulations on CPU/GPU:
- Detecting all critical sun positions – CPU
- SLA all sun positions – GPU
- SLA 5° sun positions LXP – CPU
[[NOTES:]] Stray light analysis simulations are computationally heavy because they require a high number of traced rays. The simulations “SLA all sun positions” and “SLA 5° sun positions LXP” might take several hours depending on the available hardware. You can run them overnight.
To continue with the next steps, you can download the project with pre-computed results from the shortcut "Stray_Light_Analysis_Simulation_Results" provided in the downloaded folder.
Then open the “Stray Light Analysis - Smartphone Camera.scdocx“ project (located in “\Speos\”).
Step 2: Detection of all possible critical sun positions and light leakage for the complete system
In this step we will identify all critical sun positions, detect possible light leakage of the system and display the ray paths using the Speos Light Expert feature (LXP). For this example, we assume the camera system is horizontally symmetrical. Therefore, we place an intensity sensor as a half sphere on top of the system.
- Click on the "Detecting all critical sun positions" simulation in the Speos simulation panel. The simulation results include a “Detecting all critical sun positions.Intensity.lpf” result which is the intensity captured by the half sphere “Intensity” sensor from the camera system with the “Imager Source”.
- Double-click the “Detecting all critical sun positions.Intensity.lpf” result to open the intensity map including the information of the light paths in the Virtual Photometric Lab.
-
To display the rays for each area, click on the “Measures” icon and select the area of interest (row highlighted in blue).
-
The ray paths will be shown and updated in the 3D view.
- Tip: You can export the ray paths as line geometry by right-clicking on the “Detecting all critical sun positions.Intensity.lpf” file.
The intensity result shows two critical sun directions/areas:
- Area 1. with the highest intensity (most critical sun position) in the cameras FOV. Most of the rays follow the designed optical path in sequence through the lens system.
- Area 2. Includes ray paths which follow the designed optical path but also ray paths interacting with the border and lens edge of “Even Asphere.3” which are reflected and scattered by the optomechanical components inside the camera system.
For this camera system all detected critical ray paths are within the cameras FOV and no light leakage of the mechanical components has been detected.
To identify the ray path sequences and object interactions for each area, you can apply the sequence detection analysis approach introduced in Step 4.
Step 3: Stray light simulation of four sun positions within the camera FOV (Optional).
In this step we review the results of the full system simulation for four different sun positions (from 0° to 15°) within the camera FOV.
- Click on the "SLA all sun positions" simulation in the Speos simulation panel. The simulation results include a “SLA all sun positions.Imager Layer Source.Lens @hyperfocal.1.xmp” result which is the irradiance captured by the “Imager Layer Source” sensor separated by four sun sources.
- Double-click the XMP result to open it in the Virtual Photometric Lab.
- The result was simulated with a colorimetric sensor. Inside the Virtual Photometric Lab, set the result to "True Color" and the scale level to 5000lx.
- If you want, you can also change from "True Color" to "False Color” to get the photometric luminance results.
- The simulation result was calculated including all four sun sources and an irradiance sensor set to layer “Source” which allows to have one layer for each sun position.
-
Select a sun position from the dropdown menu.
The stray light result of the complete camera system on the camera imager for four sun positions:
When you directly observe a source in a camera system, there is a sensor sun image (purple spot) and a wide variety of ghost images. Those ghost images, which degrade the optical performance, are due to reflections and ray interactions between lenses and optomechanical components, which will be analyzed in more detail in step 4.
Step 4: Analyzing the stray light path sequences and mitigate ghost stray light for one sun position
In the step 4 we introduce a workflow to analyze the ray path sequences and object interactions leading to unwanted stray light utilizing the Speos “LXP” and “Sequence Detection” features. In this example for the 5° sun position.
- Click on the "SLA 5° sun positions LXP" simulation in the Speos simulation panel. The simulation include a “SLA all sun positions.Imager Layer Source.Lens @hyperfocal.1.lpf” result which is the irradiance captured by the “Imager Layer Seq” sensor separated by 22 sequences.
- Double-click the “SLA all sun positions.Imager Layer Source.Lens @hyperfocal.1.lpf” result to open the irradiance map in the Virtual Photometric Lab.
-
The result was simulated with a colorimetric sensor. Inside the Virtual Photometric Lab, set the result to "True Color" and the scale level to 2000lx.
-
To display the rays for each area, click on the “Measures” icon and select the area of interest (row highlighted in blue).
In the following workflow the Speos sequence filtering and sequence detection features are utilized to find the cause of the ghost spot on the example of “Area_5”. Per default the Virtual Photometric Lab layer is set to “All layers” which means that no filter is applied, and all sequences are displayed.
-
Change the sequence layer to discover ray path sequences from layers 1 to 20. The sequences are ordered by energy hitting the sensor. Adapt the scale level for higher sequences.
- Now that we discovered that “Sequence 20” is responsible for the bright ghost spot in Area 5, we can analyze the light path to find out which elements or mechanical surfaces are responsible for the ghost stray light.
-
Go to “Tools"-->Sequence Detection and analyze the ray path of the Sequences 1 and 20. In this project sequence 1 represents the direct ray path interactions starting from the source object (1) through the lenses front and back faces (22,33,44,55,66,77,88) to the sensor object (9). Out of all listed sequences, “Sequence 1” contains 92.7 % of the energy detected by the sensor. The rest energy (7.3 %) can be seen as “image contamination”.
- The rays of sequence 20 are following the direct sequential path from the source (obj. 1) through the first four lenses until they get specular reflected on the front face of object 10 (Even_Asphere .4).
-
Click on object 10 to highlight the geometry in the 3D view. Tip: Right click in 3D view “Locate in structure tree” will additionally highlight the geometry in the structure tree.
-
The same workflow (Step.1 – 5.) can be applied for the other areas in the result to identify elements causing stray light.
Once the system is analyzed, the understanding of how different optical components contribute to stray light can be discussed with design and mechanical team.
Optical polished surfaces have a Fresnel reflection and transmission of 4% and 96% respectively. By changing the transmission of a surface, the specular stray light can be controlled.
AR coatings minimize reflections within an optical system. By applying an AR coating as a face optical property (FOP) on the front face of object 10 we can eliminate the ghost spot.
Important Model Settings
Description of important objects and settings used in this model
General Info - Camera design specs.
- Based on 5 asphere lenses
- Molded lenses with optical resign (DX4900 & Okp-1)
- Window for IR cut between sensor and lens system (Bk7)
- Mechanical protection window outside the camera (sapphire glass)
- Optimal Field of view: 80° (full field corresponding to the sensor diagonal)
- Effective Focal length: 2mm
- Aperture: F#1.8
- Lens depth (from first lens to sensor): 5.3mm
Meshing
Meshing settings are critical for getting correct simulation results. They define the quality of geometries that will be simulated. A mesh gives better results but also requires longer simulation time. Rough mesh can lead to poor results, especially for precise optical components. Meshing in this project is set to be proportional to the body size and a fine local meshing is applied on all optical elements. Further details about mesh settings can be found in Meshing Properties .
Materials
To determine how rays interact with geometry in Speos, we need to define optical properties of the objects included in simulation.
In Speos and in the real world, there are two types of optical properties, Surface/Face Optical Properties (SOP/FOP) such as optical polished, rough, coating and Volume Optical Properties (VOP) such as air, glass, and so on.
The materials of this project are listed in the following table:
Geometry | VOP | SOP | FOP |
IR Window | BK7 |
Perfect AR Coating |
|
Barrel, Spacers, Cover glass housing | Opaque |
Lambertian Diffuser 2.5% |
|
Ceramic Substrate, PCB Flex,
Sensor |
Opaque |
Mirror_0% |
|
Metal Cover | Opaque |
ALU.brdf |
|
Lens Edges (2,3,6) | DX4900 |
VDI33.unpolished |
Optical polished on tangent lens faces |
Lens Edges (4,5) | OKP-1 |
VDI33.unpolished |
Optical polished on tangent lens faces |
Lenses (2,3,6) | DX4900 |
Optical polished |
|
Lenses (4,5) | OKP-1 |
Optical polished |
|
Cover Glass | AL203 |
Optical polished |
Different options are available to define optical properties files including user definition via optical property editors, Plugin for surface properties which is programmable by user, and optical library which contains a set of surface and material properties measured or defined by Ansys which can be downloaded in Add-On Packages on Ansys Customer Portal .
Sun Source
For an observer on the earth, the sun has an apparent angular diameter of about 0.5 deg.
"https://en.wikipedia.org/wiki/Angular_diameter"
The sun source in this project is setup as a circular surface source in a distance (D) of 400 mm with a diameter (d) of 3.73 mm resulting in an angular diameter (δ) of 0.5 deg.
The sun source has a lambertian intensity distribution with a total angle (α) of 0.1 deg result in a beam diameter (a) of 4.43 mm which covers the complete entrance pupil.
The source spectrum can be selected from Library or using Blackbody to set the temperature of the source spectrum in Kelvins. In this example, we used Blackbody at 6000 K.
The flux of the source is set to 1 lm, which results in an average irradiance value of 100000 lx on the imager plane.
The surface source is patterned in 5° steps from 0° to 15°. The patterned is parametrized and can be easily modified for more sun positions or other incident angles.
More information regarding surface and ambient sources can be found
Surface Source (ansys.com)
and
Ambient Sources (ansys.com)
Additional Resources
Project data:
-
Project (start data)
- Stray Light Analysis - Smartphone Camera 22R2 -w/o results
-
Project (end data)
- Stray Light Analysis - Smartphone Camera 22R2 incl. simulation results
Relevant Speos Ansys Learning Hub courses
- Speos Getting Started
- Speos Workflow & Geometry Management
- Speos Camera Sensor (optional)
- Ansys Speos Light Path Finder
- Ansys Speos Stray Light Analysis
More information about smart phone lens design and stray light analysis in Ansys Zemax OpticStudio can be found in: