This example shows a workflow to set up and simulate an exit pupil expander (EPE), which is an important component for a waveguide-type augmented reality (AR) device. This workflow will utilize the dynamic link function between Lumerical and Zemax OpticStudio . To use the dynamic link, parametric models for 2D hexagonal cylinder and 1D slant gratings are constructed in Lumerical. On the other hand, the whole imaging system is built in Zemax OpticStudio. During raytracing, when a ray hits the grating, Zemax OpticStudio will automatically call Lumerical to calculate the exact electric field response, which allows an accurate evaluation of the system.
Overview
Understand the simulation workflow and key results
The EPE is one of the most popular technologies used in a waveguide-based AR system, such as Microsoft Hololens. It includes a thin glass plate (waveguide) with several gratings on it. The gratings’ period, area shape, and periodic orientation are normally planned in k-space. K-space is a 2-dimensional space where any single point in this space always represents a ray propagation direction. When a ray's propagation direction is changed by a diffraction grating, its position in this k-space is shifted by a vector, where the length of the vector is related to the period. K-space is a very useful concept for planning how the light propagation and the grating period should be for an EPE system.
It’s suggested to read the article How to simulate exit pupil expander (EPE) with diffractive optics for augmented reality (AR) system in OpticStudio: part 1 for more information on the k-space. The system in the above article is for an EPE with three 1D gratings. The main difference in this example is that we will use a 1D grating for in-coupling and a 2D grating for out-coupling. The 2D grating has a hexagonal periodic structure and the beam propagates in the k-space as shown below. As seen in the following picture, to let the beam moves in the 2D waveguide to expand the exit pupil, we design the grating to let the beam propagation direction moves like a hexagonal in k-space. This allows the beam to propagate and distribute to a large region in the waveguide, as shown in the right-side picture below.
Step 1: Constructing Parametric Grating Model
A grating model is first constructed in Lumerical and saved in a .fsp file. We will need two grating models. One is a 1D grating for coupling in the light from the source. One is a 2D grating for coupling out the light.
Step 2: Building the AR Waveguide and Checking the Power Distribution at Pupil
Next, the exit pupil expansion system is built in Zemax OpticStudio. This includes a waveguide, 2 gratings, an image source, and a simple eye system to “see” the image.
Step 3: Image Simulation
Now we are ready to run a raytracing to check the system. We will check the power distribution at the exit pupil for a point in the light source. We will also run a full image simulation and evaluate what a human eye sees via the system.
Step 4: Optimization
We can select some parameters to optimize the system performance. In this demonstration, we pick up the cylinder height as a variable and uniformity at the exit pupil for the central field as the optimization goal.
Run and results
Instructions for running the model and discussion of key results
Step 1: Constructing Parametric Grating Model
- Open the [[files lswm_1D_slant.fsp]] and [[lswm_2D_hex_cylinder.fsp]] in Lumerical FDTD and observe how they are defined.
The geometries defined in the two grating files are as below. The left image shows the 1D periodic grating in the [[lswm_1D_slant.fsp]], which will be used as an in-coupling in the AR waveguide system. The second image shows the 2D hexagonal in the [[lswm_2D_hex_cylinder.fsp]], which will be used for out-coupling.
Note that these grating files include some special settings required for the dynamic workflow between Lumerical and OpticStudio.
For example, by right-clicking on the topcell in the objects tree, we can see there are user properties with names of “p#_*****” in the two gratings files. These user properties will be directly controlled by OpticStudio. The parameters with the same name will show in OpticStudio. Any user modification to these parameters in OpticStudio will reflect to the user properties in Lumerical to update the grating geometry. Furthermore, during optimization, there are variables that we can change for getting the best system performance too.
It can also be seen that there are some scripts defined for the topcell group. These scripts are needed to convert the user properties to real geometries.
It can be observed that both grating files have some common user properties, such like period_x, period_y, n_neg, n_pos. These are required so that the grating file can be used in the dynamic link between OpticStudio and Lumerical.
There are some similar rules that need to be followed when building the grating files for the dynamic link. These rules are described in another article ( Dynamic workflow between Lumerical RCWA and Zemax OpticStudio ). Note that only when users want to create their special gratings, they need to read these details
We provide several built-in sample gratings as shown below. However, users can always customize their own following the conventions.
Step 2: Building the AR Waveguide and Checking the Power Distribution at Pupil
- Open the [[epe2d_2dgrating.zar]] in OpticStudio and observe how it’s defined.
- Set parameter “Link Lumerical (0=No 1=Yes)” to 1.
- Open Ray Trace Control dialog and trace rays.
When opening this file, we should see two Lumerical FDTD are opened as long as OpticStudio. This is because this system has two gratings defined. One is the 1D slant grating with circular region for coupling in the light. One is the 2D hexagonal grating with rectangular region for coupling out the light.
In this system, we have defined two grating objects on the surface of a glass plate (waveguide). A collimated beam is incident on the first couple-in grating. After some TIR guiding in the waveguide, it will be coupled-out by the second grating. Near to the out-couple grating, we have set up a detector to check the light distribution on the exit pupil, which is the eye box of the device.
By checking the object 2 > Object Properties > Diffraction, it can be seen a “lumerical-sub-wavelength-2023R1.dll” is selected to define the diffraction property. In the dropdown list of File Name, it can be see lswm_1D_slant.fsp is selected. The dropdown list will show all the fsp files that is saved in the folder \Document\Zemax\DLL\Diffractive\. Users need to put the grating files in this folder in order to use it as the grating structure. If we check the object 3, we can see it select lswm_2D_hex_cylinder.fsp as the grating structure.
Before tracing rays, let’s set the parameter “Link Lumerical (0=No 1=Yes)” to 1 to turn on the link. This parameter is designed allow users temporarily not to link to Lumerical and focus on setting the grating parameters. Once it’s set to 1, OpticStudio will link to Lumerical, read the specified .fsp file, and read the parameter names as below.
Now we are ready to open the Ray Trace Control dialog to trace rays, as shown below.
The raytracing result on the detector is as below. Note the two picture shows same result, but the right side is with log scale.
Note this only the shows result for the central field, which is the light from the central pixel on the image source. Let’s set Tilt About X and Tilt About Y to 5 degrees in order to check the result with different incident beam.
It can be seen the light distribution changes at the eye box. It’s clear that, for different pixel on the image source, we have different light distribution on the exit pupil. Normally, the design goal is to have uniform distribution over the exit pupil for the whole field of view (all pixels on the image source)
Step 3: Image Simulation
- Open the [[epe2d_2dgrating_image_simulation.zar]] in OpticStudio and observe how it’s defined.
- Set parameter “Link Lumerical (0=No 1=Yes)” to 1.
- Open Ray Trace Control dialog and trace rays.
In this file, several objects are added in order to do the image simulation. We replaced the collimated light by an image source, which includes 3 objects, Source DLL (Lambertian_Overfill.dll), Slide, and Paraxial Lens. The Paraxial Lens is placed right before the first couple-in grating. It will project the image at its focal plane to infinity. The Source DLL and the Slide are both at the focal plane with a little deviation, so the two objects don’t completely overlap. The Source DLL uses Lambertian_Overfill.dll, with the size matching the Slide and target pupil at the first couple-in grating. The Slide is simply a QR code for testing the image quality.
At the output of the waveguide, a simple camera system is built to simulate the image received by the human eye. This includes 3 objects, one Paraxial Lens, one Annulus, and one Detector Rectangle at the focal plane of the Paraxial Lens. The Paraxial Lens will focus the image of an object at infinity onto the Detector Rectangle at the focal plane.
When opening the file, it can already see there is already an image on the detector viewer. It’s suggested users try to open the Ray trace Control dialog and trace it by themselves to see how it works.
Step 4: Optimization
- Open the [[epe2d_2dgrating_optimization.zar]] in OpticStudio and observe how it’s set up for optimization.
- Set parameter “Link Lumerical (0=No 1=Yes)” to 1.
- Open local optimizer and perform optimization.
In this example, we demonstrate the process of optimization. It’s only a simple example and doesn’t optimize the system to be perfect but should give a good overview of how to optimize the system.
The system in this file is based on the one built in step 2, but with a little modification. In this file, we added the merit function and a variable for optimization.
In the merit function, line 7 calculates the standard deviation of the irradiance on non-zero pixels. The lower this number is, the better the uniformity of the system is. Line 8 and 9 constrains the total efficiency to be larger than 0.015.
In this system, the out-coupling grating has been cut into 6 pieces. This is needed as we want different diffraction efficiency for different regions. The ultimate goal is to have a uniformly distributed irradiance at the exit pupil (eye box) of the device. Note that two pieces of the grating zone are set to ignore the raytracing. This is because the system has symmetry and we want to utilize it to speed up the optimization.
The variable is set up in the multi-configuration editor. It corresponds to the cylinder height in the central-top grating.
To optimize this system, we can simply open the local optimizer and run it with the Orthogonal Descent algorithm. The reason not to use DLS is that the merit function space for this system can be very noisy where Orthogonal Descent can perform well.
After optimization, the image uniformity is better as below.
Important model settings
Description of important objects and settings used in this model
There are several parameters in the DLL settings in Zemax OpticStudio that is worth a mention.
Max Order X, Y
This specifies how many harmonics (orders) are to be considered in the RCWA solver. The higher this number is, the more accurate the result is, but the slower the calculation speed is. When it’s set to 3, it means we consider -3, -2, -1, 0, 1, 2, 3, a total of 7 orders in the calculation.
Only when we do a convergence test, we can know if this number is large enough.
A rule of thumb is to set this number to wavelength/period*3.
When both X, Y are >= 0, Max Order Y is ignored and a circular area in harmonic (diffraction order) space is sampled, as shown at below left side.
When X<0 or Y<0, a rectangular area is sampled in harmonic space. The half-width in the x and y directions of the rectangular area are the absolute value of Max Order X and Y, as shown on right side.
Interpolation & Interp. Pre-sampling
The two parameters control how the data from Lumerical is cached in the RAM. In this workflow, the data calculated by Lumerical for each incident angle are cached and then interpolated for arbitrary incident angle, as shown below.
Updating the model with your parameters
Instructions for updating the model based on your device parameters
Grating shape
The gratings’ shape in this example are 1D slanted grating and 2D cylinder pillar. Users can follow Dynamic workflow between Lumerical RCWA and Zemax OpticStudio to build their own grating model.
Grating zone shape
In this example, the grating zone shapes on the waveguide are circle (in-couple grating) and rectangle (out-couple grating). It is possible to change any of them to polygon. To define a polygon grating zone, users can download the corresponded User Defined object DLL from How to simulate exit pupil expander (EPE) with diffractive optics for augmented reality (AR) system in OpticStudio: part 4 .
Additional resources
Related KB pages: