This article describes an integrated workflow where the optical design (lens model), the mechanical packaging (CAD geometry), and the sensor optical response are imported into Ansys Speos and analyzed together in a single end-to-end scene perception simulation. GPU computation is leveraged to reduce time-to-result and support practical iteration cycles. The objective is to generate a realistic image considering the straylight in a 3D scene. The integrated result reveals not only whether flare is present, but also how dominant it is in a realistic scene.
Software prerequisites
- Ansys Zemax OpticStudio 2025 R2 (optional, for exporting the lens file, ODX file)
- Ansys Speos 2025 R2 SP4 (GPU compute recommended for fast perception results)
- Sensor optical response data (optional, from Ansys Lumerical or measurement)
Authored By Mina Nazari, Aubry Grossetete, Benoit Heraud
Overview
Understand the simulation workflow and key results
Integrated import workflow and end-to-end GPU scene perception run
This workflow imports the complete camera stack (lens + mechanics + sensor optical model) into Speos, brings in the 3D scene, and runs one integrated simulation in a realistic environment. The result is a sensor image that includes the combined effects of the scene, lens behavior, packaging reflections/scattering, and sensor backscattering—enabling full-system validation in context.
System description
- Lens model : The lens, along with its coatings, was exported from OpticStudio via Optical Design Exchange (ODX) and then imported into Speos.
- Optomechanical packaging : lens barrels, baffles, and mounts imported from CAD and updated via Geometry Update when the design changes.
- Sensor model : active area assigned an angle and wavelength-dependent optical response (reflectance and/or diffractive backscattering behavior), imported as a surface optical property.
- Scene : high-contrast outdoor environment (Road + Train + objects) positioned relative to the camera to represent the application use case.
- Sources : Uniform sky illumination plus a collimated sun source (bright off-axis source) to stress the system and reveal flare paths.
The workflow below keeps the same overall logic as a full-system validation Analysis (prepare subcomponents, integrate in Speos, run and analyze), and this article emphasizes on Step 3 and 4, importing all contributors up front and computing an integrated end-to-end perception result with GPU acceleration.
Step 1: Optical Design of the lens system - Ansys zemax(not covered) - ODX link to step 2
- Design and Optimize the lens system using OpticStudio tools.
- Export the lens as ODX from OpticStudio (includes optical surfaces, materials, and coatings as supported by the exchange workflow).
Step 1b: Optical Design of the sensing component - Ansys Lumerical (not covered) - sensor response link to Step 2
- Generate / validate the sensor optical response (angle- and wavelength-dependent behavior). Typical inputs include R/T curves, diffractive order efficiencies, coming from Lumerical simulation or measurement.
Step 2: Camera preparation - Ansys Speos (import ODX and import lumerical plugin)
- Import the optical design into Speos (ODX lens model)
Use the Optical Design Exchange to import lens system via odx file into the scene in speos and adjust/confirm the axis system, aperture stop location, and sensor/image plane reference such that it is consistent with the mechanical coordinate system. More information can be found in Stray Light Analysis – Smartphone Camera
- Import the mechanical packaging (CAD) and assign optical properties
Import the optomechanical assembly (barrels, baffles, mounts, cover glass holder) and use a geometry update workflow so future CAD revisions can be pulled into the same Speos project without rebuilding the material model. Assign realistic surface behavior (BRDF/BSDF, absorption) to key internal surfaces where scattering and glints drive flare. More information can be found in Cell phone Camera Lenses Part 2: Optomechanical Packaging
Note: in case needed the measured 360 BRDF can be applied on the components for high fidelity. More information can be found in Speos BRDF, BTDF and BSDF Formats – Ansys Optics
- Apply the sensor optical response (surface optical property)
Assign the imported sensor property to the active area of the imager via surface optical property-plugin functionality. The plugin enables you to read the exported file from Lumerical/measurement. More information can be found in LSWM plugin: Data Generation , LSWM plugin: Usage in Speos
Step 3: Scene preparation - Ansys Speos
- Import or build the 3D scene; clean up or modify geometry if needed.
- Define illumination (sky/natural light + a collimated sun source).
Step 4: Visualization analysis of the camera in 3D scene - Ansys Speos
- Set up the inverse simulation to include camera elements and scene components in the selected geometry, select both the sources and the irradiance sensor at the lens model's image plane. Enable dispersion in the simulation settings.
- With an Nvidia GPU and HPC license, use GPU acceleration for faster Monte Carlo ray tracing and quicker design iterations; otherwise, use CPU computation.
Run and Results
Instructions for running the model and discussion of key results
Single integrated compute and component-level contribution analysis
Step 2: Camera preparation - Ansys Speos (import ODX and import lumerical plugin)
To import your camera system, first compute the existing ODX model from the Cellphone_Camera component in the simulation tree. Click on Optical Part Design Exchange and select "Compute" in the main window, or right-click and choose "Compute". This imports the ODX into SPEOS.
The next step involves utilizing Speos LightBox, a specialized data exchange container designed to package meshed geometries along with their associated optical data, including optical properties, scattering models, and meshing settings, into a single file. This file can be encrypted and imported for use within Speos simulation, effectively reducing the initialization time for simulations. Additionally, LightBox enables suppliers and internal teams to share optical components that are ready for immediate use while safeguarding intellectual property, as it offers password protection or full black-boxing to restrict access to internal details or light propagation mechanisms.
-
Compute CellPhone.Lens+Meca.Export to generate the external file.
-
In CellPhone.Lens+Meca.Import, locate the Speoslightbox file you created and compute it.
- Utilize the existing Inverse Simulation , Straylight_GPU , located in the Speos simulation tree.
- Confirm that CellPhone.Lens+Meca.Import is selected as the geometry for this simulation, with Bright sun source set as the light source and the pre-defined irradiance sensor at the imager chosen as the sensor.
Step 3: Scene preparation - Ansys Speos
To create a realistic environment for the camera system, you can import scene elements using CAD or glTF (glTF 2.0) formats. In this example, the road (a CAD element) has already been imported, and its materials and textures are defined (check Road material). To import glTF items like the train and railway barrier, follow these steps:
GLTF files can be sourced from online platforms, such as Sketchfab [ sketchfab.com ]. For this example, download the Train and Railway Barrier glTF file. Then from the Assembly tab in Speos, select glTF Import and import the Train .gltf or .glb file. from the downloaded folder. Once imported, the gltf element appears as a mesh component in the structure tree, with materials and UV mapping preserved. After importing the glTF component, adjust it so it is correctly positioned and scaled relative to the camera.
- In the structure tree, click on the desired element, for example train.
- Use the Move Tool (found under the Assembly tab) to place your imported components within the 3D scene.
- Select the Upto option of Move tool.
-
Choose the corresponding axis system already defined in the structure tree.
-
Use the move tool to rotate the train to 270 degree.
- Repeat for Railway Barrier glTF file and position it with move>up to functionality to the Barrier origin.
Once imported, they appear as meshes in the SpaceClaim structure tree, with materials and UV mapping linked and shown in the Speos tree.You can use Speos's direct modeler functionality for cleanup and scaling if needed, though it isn't necessary in this example.
How to create both illumination contributors, even tough it's already done in the Speos file :
-
Uniform sky source [already done]
To define the uniform sky source, go to the Light Simulation tab > Sources, then from Ambient choose Uniform Source. In the simulation tree, double-click the created uniform source and modify the spectrum as required. For example, we have selected blackbody and with 5000 K.
-
Collimated sun source [already done]
The Surface source in this example, represents a bright off-axis source and is used to stress the system and reveal flare and stray light paths.
In this example, the sun (collimated Sun parametric source) is currently placed at an off-axis angle of 2° relative to the Camera axis. Feel free to modify this angle and/or the source position to match your application scenario. The sun source angle is defined using a parameter in SpaceClaim. To change it, open the Group tab and edit the corresponding predefined parameter (driving the bright source location). Updating this parameter will move the bright source accordingly in the scene.
Step 4: Visualization analysis of the camera in 3D scene - Ansys Speos
Once all components are prepared, create an inverse simulation that combines the ROM camera system and the 3D scene with Environment source.
- Create a new Inverse Simulation or use the existing Camera_ROM simulation in the Speos simulation tree. Rename it to Camera ROM.
-
In the selected geometry , hit control on your keyboard and select the Scene component including train, objects, Road elements.
-
Add uniform source to contribute to the inverse simulation.
-
Select the Camera ROM Cellphone as the sensor for this simulation.
- Run the simulation with GPU : Right-click the inverse simulation. Select GPU Compute (supported by NVIDIA hardware and HPC licensing). If GPU is not available to you, run using CPU compute. Modify the simulation time limit as needed.
GPU acceleration significantly reduces convergence time for Monte Carlo ray tracing and enables faster design iterations.
After completion of the inverse simulation, review the perceived image / irradiance map output .
After you run the inverse simulation (GPU Compute), the corresponding irradiance map (.xmp) is automatically created in the simulation tree. Double-click the generated irradiance.xmp result to open it and view the full, accurate irradiance/perceived image which includes
- Scene illumination from the uniform light source
- Direct sun contribution
- Stray light from lens surfaces
- Scattering from mechanical components
- Sensor induced back reflection effects
Combine the results achieved from the environment source and the one from the bright source via speos photometric calc.
From the Light simulation> Tools>viewer>select virtual Photometric calc
Choose the source files, Camera ROM.Camera.ROM_CellPhone.Irradiance.xmp and Straylight_GPU.Sensor.CMOS.xmp. Then, select the operation "Map union" and pick a title for the results file, such as Straylight_GPU.xmp, to be generated. Finally click on process. This will create a results file with your selected name, containing the combined outcomes of the irradiance maps.
This integrated result encompasses scene perception as well as all stray light contributors. The irradiance maximum level can be adjusted using the level tool within the Map union XMP results. If you are interested in examining the sensitivity of the outcomes to the light source powers, it is not necessary to rerun the simulation with new power settings. You can simply access the virtual light controller tool in the XMP results and modify the percentage power of each source, allowing for an evaluation of potential flare risks in your system. As demonstrated here, the flare is sufficiently intense such that the barrier is not visible within the camera's field of view.
With this workflow, you can fully perform perception of the complete imaging chain in your scene, including the lens system, camera mechanics/packaging, and the sensor model, and understand their impacts in the final image. This provides a practical way to quantify contrast loss and validate design choices early. In other words, it enables virtual prototyping and digital-twin-style validation of your camera system before building physical hardware, accelerating iteration on coatings, baffles, and sensor-stack mitigations.
To iterate, update the relevant component and re-run the same workflow without rebuilding the full project: re-export and re-import your lens ODX if the optical design changes, use Geometry Update to pull in revised barrels/baffles if the CAD is modified, or replace the sensor JSON/SOP file if the pixel stack model is updated. Then re-run the perception simulation (GPU Compute) and compare the before/after perceived images and key indicators (for example, ghost intensity around the bright source, veiling glare level, and contrast loss in darker regions) to confirm improvements.
Important Model Settings
Description of important objects and settings used in this model
Geometry cleanup
You can select the unnecessary faces that are not relevant to the optical analysis (for example, hidden geometry) and simply delete them. This reduces computational load and improves simulation initialization time.
Scaling
If the imported scene element is not to scale, use the Scale tool in the facet > modify tab. Select the component from the structure tree and click the Scale tool. In the Graphics window, choose the faceted body (or bodies). Pick a point on the body to scale from, then drag to adjust or press Spacebar to enter a value.
- Alternatively, you can use the Pull tool to resize the faceted body.
This ensures the scene's distances and proportions match real-world scenarios.
Once the scene elements are positioned and cleaned, the glTF scene can be used directly in non-sequential ray tracing analysis.
To check if the element is within the camera's FOV, double-click the Camera ROM Cellphone in the simulation tree, then click the preview icon in the GUI to view the camera's FOV, and adjust element positions as needed.
Updating the model with your Parameters
Instructions for updating the model based on your device parameters
Taking the Model Further
Ideas on how the simulation could be extended to cover more effects or more general scenarios.
- Sweep sun position and its intensity (multiple off-axis angles) to build a flare risk map across the camera field of view.
- Perform baffle/coating trade studies using face optical properties and compare improvements with identical run settings.
- Extend to sensor performance realism (EMVA 1288 parameters, RAW export, and post-processing pipeline) to connect stray light to Raw image and final image perception.
- Expand to component-level analysis: lens, mechanics, and sensor.
- Animate the scene thanks to Timeline functionalities of Speos and combine straylight signal on top of a moving object in a scene or a moving sensor.
you can estimate the origin of artifacts by using path/sequence tools and controlled comparisons in the same project setup via straylight analysis:
- Lens contribution: use sequence filtering to identify dominant internal reflections (ghost paths) and determine which optical surfaces contribute most energy to the detector.
- Mechanical contribution: isolate rays that interact with specific groups (barrels/baffles) and review which faces inject the most stray energy into the lens/sensor path.
- Sensor contribution: compare runs where the sensor optical property is enabled vs. replaced with an ideal absorber/black surface to quantify sensor-driven back-reflection and flare patterns.
Additional Resources
Additional documentation, examples and training materials.
You can find below some learning paths based on application:
Camera Straylight Analysis:
- Step 1 : Designing Cell phone Camera Lenses Part 1: Optics
- Step 2: Stray Light Analysis with Ghost Focus Generator
- Step 2: Cellphone Camera - Sequence grouping (upcoming article)
- Step 3: Designing Cell phone Camera Lenses Part 2: Optomechanical Packaging
- Step 3: Stray Light Analysis – Smartphone Camera
- Step 2&3 (automation): Automating system-level stray light analysis and optical noise reduction with Ansys Optics
-
Step 4:
Stray Light Analysis in a 3D scene (upcoming article)
Fundamental Straylight learning resources:
Relevant Zemax Ansys Learning Hub courses:
Relevant Speos Ansys Learning Hub courses:
- Stray Light Analysis of Cellphone Camera
- Stray Light Analysis in Ansys Speos
- Optical Design Exchange
- Light Expert in Ansys Speos
- Ansys Speos Workflow and Geometry Management
- Physical Camera Sensor in Ansys Speos