A Detailed Workflow to Analyze Stray Light in Smartphone Cameras Using CODE V and LightTools

Optical Solutions Editorial Team

Jun 14, 2023 / 6 min read

Stray light is any electro-magnetic radiation that is unwanted and interferes with the performance of an optical system’s intended functions. Examples of stray light include ghost images, which are specular reflections off optical surfaces, and flare, which is reflection or scattering off non-optical path surfaces. Ghost images and flare are caused by the camera lens and mounting structure. Stray light analysis will help you find the sources of these effects and minimize them in your optical design.

CODE V and LightTools provide a powerful workflow to identify and address the effects of stray light in your system prior to manufacturing. In this article, we outline the workflow using a smartphone camera system as an example.

Examples of flare and ghost images in photos taken with a smartphone camera

Examples of flare and ghost images in photos taken with a smartphone camera

CODE V and LightTools Workflow for Stray Light Analysis

CODE V and LightTools provide advanced optical design, optimization, and fabrication support capabilities. Together, they support a highly effective workflow for identifying and minimizing stray light effects early in the design process.

The workflow includes the following steps:

  • Create the imaging system design using CODE V’s design, optimization, and tolerancing capabilities, and perform a ghost image analysis.
  • Bring the imaging system design into LightTools for detailed analyses of the effects of extended sources and mechanical parts.
  • Finalize your design in CODE V to optimize for manufacturability and control costs in production.
Smartphone camera system designed in CODE V (left) and imported into LightTools (right) to add optomechanical parts and perform stray light analysis

Smartphone camera system designed in CODE V (left) and imported into LightTools (right) to add optomechanical parts and perform stray light analysis

Create the Imaging Design and Perform Ghost Analysis

The first step is to design the lens system in CODE V to meet optical performance requirements. The examples shown in this article highlight a smartphone lens model that includes a patented compact lens module for a 1/3” CMOS detector (US Patent #7,646,552). As shown in the following figure, elements 1-4 consist of the lenses, element 5 is an IR cut filter or cover plate, and element 6 is the CMOS detector.

Smartphone camera design in CODE V

Smartphone camera design in CODE V

For this design, the aspheric surfaces were converted to Qcon surfaces, which are characterized by the sag departure of the aspheric surface from a base conic. This aspheric surface formulation gives designers a high level of control over the surface terms, which avoids unnecessary complications in fabrication and testing to reduce costs. CODE V has a straightforward process for converting aspheric surfaces to Qcon surfaces that maintains the surface shape.

In a smartphone camera system, the detector can be a source of ghost images because of the reflectivity of the metal wires in the sensor. Light reflecting off the detector structure can be returned to the detector by lens surfaces.

CODE V has powerful tools for analyzing ghost images, including:

  • Ghost (GHO) analysis feature
  • The supplied macro ghost_view.seq
  • The @GHOST macro function

The Ghost analysis feature and the ghost_view macro provide data in tabular and visual formats. The analysis is fast and allows you to easily isolate surface pairs for further analysis or optimization control. The @GHOST macro function allows you to control for ghost image disk size during optimization by specifying a surface pair to control.

Following are examples of ghost_view reflections from a field angle of 2 degrees.

Ghost image analysis in CODE V

Ghost image analysis in CODE V

Once you have completed the lens design and ghost analysis in CODE V, you can then export the design to LightTools to perform the optomechanical design and flare analysis.

Analyzing the Effect of Extended Sources and Mechanical Parts

Interoperability features between CODE V and LightTools support high-fidelity optical product simulations. CODE V surface-based models are automatically converted to solid models in LightTools, and design updates are seamlessly maintained between the products. Surface geometry from CODE V is maintained while you apply optical properties, receivers, and sources in LightTools.

When we brought the smartphone camera design into LightTools, we added a distant Lambertian source with the aim area set to the stop surface. We also defined an edge aperture on the image surface to size the receiver correctly and added a lens system housing. Finally, we adjusted optical properties for the lenses, lens system housing, and detector to prepare for the illumination simulation.

Lens housing defined in LightTools

Lens housing defined in LightTools

The LightTools Ray Path Analyzer feature, which records each individual path that rays take as they traverse the system, is particularly helpful for providing a quantitative analysis of ghost images. Ray path analysis can pinpoint specific aspects of ghost and stray irradiance and determine the next steps in your design process to minimize these effects, such as making modifications to curvatures, changing coatings, and varying surface treatments.

In addition, designers who use forward simulations to generate illuminance or intensity data can perform a region analysis to examine a specific portion of their results on the receiver. After you run a simulation, you can use the cursor to sketch the boundaries of a rectangular region on the LightTools LumViewer chart to see which rays contribute to the data for that region. This helps you gain a better understanding of where individual ghost or stray light paths are coming from. Knowing which optical surface contributes the most to the total stray light signal helps you determine which surfaces need anti-reflective coatings.

LightTools region analysis example

LightTools region analysis example

With LightTools ray path analysis, you can view various ray paths within the optical systems that create individual ghost images on the sensor (receiver). This data can identify how much unwanted power is incident on a detector, for example, or identify the peak power when looking for distinct ghost images and evaluating a system prone to laser damage. In the following figure, a ray path filter has been applied. Once the simulation runs, the ray path filter provides a list of all potential ray sequences in the optical system. You can sort ray paths according to their individual power or luminance contribution. The figure shows ghost images (luminance distributions) of different ray paths in the optical system.


LightTools region analysis showing ghost images of various ray paths in the optical system

LightTools region analysis showing ghost images of various ray paths in the optical system

Additional LightTools features that are useful for stray light analysis include:

  • Support for the Harvey-Shack and ABg scattering models, as well as a scatter evaluation tool, to simulate highly polished surfaces
  • Ability to model rough surfaces using microfacet modeling
  • Receiver filters that track ray-surface interactions and identify contributions from ghosts and flare. These filters can help designers isolate imaging rays or specular and scatter illuminance.
  • Options for specifying a Normalized Power Range to filter analysis results to a subset of ray paths based on the total power collected in each path.
  • Scatter aiming features that provide flexibility when specifying aim areas, with options for polygonal and surface-based shapes, as well as the ability to position the aim area in global coordinates.
  • Contamination scattering for modeling the effects of dust and other particulates that may contaminate optical surfaces, such as mirrors.

Finalizing Your Design in CODE V

As a last step, you can further optimize your design in CODE V to control the size of the ghost image from a specific surface pair; this can be easily accomplished with a user-defined constraint in the supplied macro function @GHOST. You can also use real ray constraints to control the sensor-lens ghost by keeping the refracted ray away from the surface normal.

If you would like to try CODE V and LightTools, submit a request to set up a 30-day evaluation.

Continue Reading