PDF

Double Gauss Lens Image Simulation
Introduction
If a lens has designed for an imaging application, it is useful to simulate the image that a user would expect see. In this tutorial we demonstrate how to load a bitmap that can be used as the object in a finite conjugate ray trace.
Model Definition
The model used in this simulation is the Double Gauss Lens found in the Ray Optics Module Application Libraries. The lens shown in Figure 1 is a 100 mm focal length lens by Lautebacher & Brendel (see Ref. 1). Full details of this model (including instructions for creating the lens geometry) can be found in the Double Gauss Lens tutorial.
Figure 1: The Double Gauss Lens geometry sequence. Details of this lens are from Ref. 1.
Study 1
The lens, which has an f/1.7 focal ratio and a 19° field of view, has a focal plane which is positioned for imaging an object at infinity. In this model we will place the bitmap at a distance of 1 meter in front of the lens. Study 1 is therefore used to determine the new finite conjugate focal plane.
We do this by releasing a cone of rays from the point on the optical axis intersecting the object plane. The rays can be made to ignore the image surface because, as can be seen in the Ray Diagram shown in Figure 2, the focus is now somewhere behind this plane.
The Spot Diagram feature can be used to automatically find the location of the best RMS focus (see Figure 3). The on-axis aberrations can also be seen in Figure 4. For more details see the Modeling Instructions at the end of this document.
Figure 2: A ray diagram showing the finite conjugate ray trace. The rays now pas through the nominal focal plane.
Figure 3: A spot diagram showing the global coordinates of the finite conjugate focal plane.
Figure 4: The aberration plot showing the wavefront error at the new focus. The left diagram includes all Zernike terms, whereas the right diagram does not include piston and defocus.
Study 2
The image simulation is performed using Study 2. First, the geometry is updated to locate the image plane at the new focus. In this simulation only a small section of the object surface will be sampled. Therefore, the geometry now includes rectangular surfaces on both the object and image planes (see Figure 5). These are approximately scaled so that an object (the bitmap) placed on the object surface will be imaged onto the section of the image plane defined by the image surface.
The Mesh is used to define the spatial sampling of the rays that are released from the object surface, and the spatial binning of rays on the image surface. A Mapped mesh with a Distribution set to have a fixed number of elements is applied to each of the object and image surfaces. The number of elements is npix on the image surface and 2*npix on the object surface.
The rays used in this simulation are defined using a Release from Boundary feature. The spatial density of these rays as they are released from the object surface is proportional to the value of the imported bitmap. Each ray is released into a solid angle approximately centered on the entrance pupil of the lens. A random sampling from within this cone gives a uniform distribution of rays across the entrance pupil.
Detailed step-by-step instructions can be found in the Modeling Instructions.
Figure 5: The Double Gauss Lens Image Simulation geometry. The object surface is on the left.
Results and Discussion
A simulation using 100,000 rays is shown in Figure 6 and Figure 7. Figure 8 shows the 2D image side by side with the original bitmap object.
Figure 6: Ray diagram showing the object and image surfaces together with a fraction of the rays used in this simulation.
Figure 7: A closeup of the image simulation ray diagram.
Figure 8: The object (left) and the resulting ray traced image (right).
Reference
1. W.J. Smith, Modern lens design, vol. 2. New York, NY, USA: McGraw-Hill, 2005.
Application Library path: Ray_Optics_Module/Lenses_Cameras_and_Telescopes/double_gauss_lens_image_simulation
Modeling Instructions
Application Libraries
1
From the File menu, choose Application Libraries.
2
In the Application Libraries window, select Ray Optics Module>Lenses Cameras and Telescopes>double_gauss_lens in the tree.
3
Component 1 (comp1)
For this simulation the diameter of the aperture stop is slightly reduced. This will slightly improve the image quality at the finite conjugate focus.
In the Model Builder window, expand the Component 1 (comp1) node.
Double Gauss Lens
Stop (pi4)
1
In the Model Builder window, expand the Component 1 (comp1)>Double Gauss Lens node, then click Stop (pi4).
2
In the Settings window for Part Instance, locate the Input Parameters section.
3
Geometrical Optics (gop)
Use the following steps to determine the distance to the finite conjugate focal plane.
Release from Grid 2
1
In the Model Builder window, under Component 1 (comp1) right-click Geometrical Optics (gop) and choose Release from Grid. This will be used to release rays from the object plane.
2
In the Settings window for Release from Grid, locate the Initial Coordinates section.
3
In the qz,0 text field, type -1[m].
4
Locate the Ray Direction Vector section. From the Ray direction vector list, choose Conical.
5
From the Conical distribution list, choose Hexapolar.
6
In the Nθ text field, type N_ring.
7
Specify the r vector as
This is the direction of the optical axis.
8
In the α text field, type 0.70*atan(0.5*d1_clear_1/1[m]). This is the approximate angular size of the Double Gauss Lens entrance pupil as seen from the object plane.
Study 1
Next, adjust the study to allow for the finite conjugate ray trace.
Step 1: Ray Tracing
1
In the Model Builder window, expand the Study 1 node, then click Step 1: Ray Tracing.
2
In the Settings window for Ray Tracing, locate the Study Settings section.
3
In the Lengths text field, type 0 1200. The maximum optical path length now accounts for the distance to the object plane.
4
Locate the Physics and Variables Selection section. Select the Modify model configuration for study step check box.
5
In the tree, select Component 1 (Comp1)>Geometrical Optics (Gop)>Release from Grid 1 and Component 1 (Comp1)>Geometrical Optics (Gop)>Image.
6
Right-click and choose Disable. This disables the original (infinite conjugate) release. It also allows the rays to pass through the image plane which needs to be repositioned.
7
In the Home toolbar, click  Compute.
Results
First, update the ray diagram to show the finite conjugate ray trace.
Ray Diagram 1
1
In the Settings window for 3D Plot Group, locate the Color Legend section.
2
Clear the Show legends check box.
3
Click  Plot Last.
4
In the Ray Diagram 1 toolbar, click  Plot.
5
Click the  Zoom Extents button in the Graphics toolbar. Compare the result to Figure 2.
Spot Diagram
We now use the Spot Diagram feature to compute the new focus position.
1
In the Model Builder window, click Spot Diagram.
2
In the Settings window for 2D Plot Group, locate the Color Legend section.
3
From the Position list, choose Right.
4
Click  Plot Last.
Spot Diagram 1
1
In the Model Builder window, expand the Spot Diagram node.
2
Right-click Spot Diagram 1 and choose Disable. This spot diagram is no longer used in this modified study.
Spot Diagram 2
This spot diagram uses an Intersection Point Dataset.
1
In the Model Builder window, click Spot Diagram 2.
2
In the Settings window for Spot Diagram, click to expand the Inherit Style section.
3
From the Plot list, choose None.
4
Click to expand the Focal Plane Orientation section. Click Recompute Focal Plane Dataset. The Intersection Point Dataset will be repositioned to minimize the RMS spot size.
Color Expression 1
1
In the Model Builder window, click Color Expression 1.
2
In the Settings window for Color Expression, locate the Expression section.
3
In the Expression text field, type at(0,gop.phic).
4
In the Spot Diagram toolbar, click  Plot. The global coordinates this location can be now be seen in this plot. Compare the result to Figure 3.
Optical Aberration Diagram
Update the Optical Aberration Diagram to show the aberrations with the adjusted focus.
1
In the Model Builder window, under Results click Optical Aberration Diagram.
2
In the Settings window for 2D Plot Group, click  Plot Last.
Optical Aberration 1
1
In the Model Builder window, click Optical Aberration 1.
2
In the Settings window for Optical Aberration, locate the Focal Plane Orientation section.
3
Click Recompute Reference Hemisphere Dataset. This will also reposition this dataset at the location that minimizes the RMS spot size. Compare the result to Figure 4.
Global Definitions
Add a new parameters node containing details of the image simulation. A parameter defining the distance to the finite conjugate focal plane location is entered here. The total number of rays to use in the image simulation (Nrays) is also defined here.
Parameters 3: Image Simulation
1
In the Home toolbar, click  Parameters and choose Add>Parameters.
2
In the Settings window for Parameters, type Parameters 3: Image Simulation in the Label text field.
3
Locate the Parameters section. In the table, enter the following settings:
In the following steps we add the object plane and update the location and size of the image plane.
4
In the Model Builder window, under Global Definitions right-click Geometry Parts and choose Part Libraries.
Part Libraries
1
In the Part Libraries window, select Ray Optics Module>3D>Apertures and Obstructions>rectangular_planar_annulus in the tree.
2
Click  Add to Model.
Double Gauss Lens
Image (pi8)
1
In the Model Builder window, under Component 1 (comp1)>Double Gauss Lens click Image (pi8).
2
In the Settings window for Part Instance, locate the Part section.
3
From the Part list, choose Rectangular Planar Annulus. This will convert the image plane from circular to rectangular.
4
Locate the Input Parameters section. In the table, enter the following settings:
5
Locate the Position and Orientation of Output section. Find the Coordinate system to match subsection. From the Take work plane from list, choose Lens 1 (pi1).
6
From the Work plane list, choose Surface 1 vertex intersection (wp1).
7
Find the Displacement subsection. In the zw text field, type Z_focus. This is the z-component of the best focus position.
Object
1
In the Geometry toolbar, click  Parts and choose Rectangular Planar Annulus. This plane will to position the object (an imported bitmap) in this simulation.
2
In the Settings window for Part Instance, type Object in the Label text field.
3
Locate the Input Parameters section. In the table, enter the following settings:
4
Locate the Position and Orientation of Output section. Find the Coordinate system to match subsection. From the Take work plane from list, choose Lens 1 (pi1).
5
From the Work plane list, choose Surface 1 vertex intersection (wp1).
6
Find the Displacement subsection. In the zw text field, type -1[m].
7
Click to expand the Boundary Selections section. Click to select row number 1 in the table.
8
Click New Cumulative Selection.
9
In the New Cumulative Selection dialog box, type Object Plane in the Name text field.
10
11
In the Settings window for Part Instance, click  Build All Objects. The new geometry for this model can be seen in Figure 5.
Mesh 1
Details of the mesh need to be defined to support the image simulation.
Size 1
1
In the Model Builder window, under Component 1 (comp1) right-click Mesh 1 and choose Size.
2
In the Settings window for Size, locate the Geometric Entity Selection section.
3
From the Geometric entity level list, choose Boundary.
4
From the Selection list, choose Clear Apertures.
5
Locate the Element Size section. Click the Custom button.
6
Locate the Element Size Parameters section. Select the Maximum element size check box.
7
Size
1
In the Model Builder window, click Size.
2
In the Settings window for Size, locate the Element Size section.
3
From the Predefined list, choose Extra fine. It is necessary to increase the level of the Physics-based mesh refinement to account for the increase in size of the model geometry.
Mapped 1
1
In the Mesh toolbar, click  Boundary and choose Mapped. A mapped mesh will be used to define the spatial bins for releasing rays from the object, and for accumulating the image.
2
In the Settings window for Mapped, locate the Boundary Selection section.
3
From the Selection list, choose Object Plane.
Distribution 1
1
Right-click Mapped 1 and choose Distribution.
2
3
In the Settings window for Distribution, locate the Distribution section.
4
In the Number of elements text field, type 2*npix. This ensures that there are approximately two mesh elements (in each direction) on the object plane for each image mesh element.
Mapped 2
1
In the Mesh toolbar, click  Boundary and choose Mapped.
2
In the Settings window for Mapped, locate the Boundary Selection section.
3
From the Selection list, choose Image Plane.
Distribution 1
1
Right-click Mapped 2 and choose Distribution.
2
3
In the Settings window for Distribution, locate the Distribution section.
4
In the Number of elements text field, type npix.
Free Tetrahedral 1
1
In the Mesh toolbar, click  Free Tetrahedral.
2
In the Settings window for Free Tetrahedral, click  Build All.
Definitions
In this section we load a bitmap to use as the object in this simulation.
Image 1 (im1)
1
In the Home toolbar, click  Functions and choose Local>Image.
2
In the Settings window for Image, locate the File section.
3
Click  Browse.
4
5
Locate the Coordinates section. In the x minimum text field, type -h_object/2.
6
In the x maximum text field, type h_object/2.
7
In the y minimum text field, type -h_object/2.
8
In the y maximum text field, type h_object/2.
9
Locate the File section. Click  Import.
Geometrical Optics (gop)
Here we add a release to launch rays based on the imported bitmap.
Release from Boundary 1
1
In the Physics toolbar, click  Boundaries and choose Release from Boundary.
2
In the Settings window for Release from Boundary, locate the Boundary Selection section.
3
From the Selection list, choose Object Plane. This is the Boundary Selection referenced in the geometry Part Instance that defines the object plane.
4
Locate the Initial Position section. From the Initial position list, choose Density.
5
In the N text field, type Nrays.
6
In the ρ text field, type comp1.im1(x,y). The number density of the rays launched from the object plane will be proportional to the value of the image at each launch location.
7
Locate the Ray Direction Vector section. From the Ray direction vector list, choose Conical.
8
In the Nw text field, type 1.
9
Specify the r vector as
This direction vector points to the center of the first plane of the first lens.
10
In the α text field, type 0.70*atan(0.5*d1_clear_1/abs(z)). The release angle is defined so that the entrance pupil is slightly overfilled.
11
From the Sampling from distribution list, choose Random. A random distribution ensures the entrance pupil is well sampled.
Image
In the Model Builder window, click Image.
Accumulator 1
1
In the Physics toolbar, click  Attributes and choose Accumulator. This will be used to create the image in the focal plane.
2
In the Settings window for Accumulator, locate the Accumulator Settings section.
3
From the Accumulator type list, choose Count.
4
From the Accumulate over list, choose Rays in boundary elements.
5
In the Accumulated variable name text field, type Inum.
6
In the R text field, type 1. In this monochromatic simulation, each time a ray hits the image plane it is summed to create the final image.
Before adding a new study (Study 2), first update Study 1.
Study 1
Step 1: Ray Tracing
1
In the Model Builder window, under Study 1 click Step 1: Ray Tracing.
2
In the Settings window for Ray Tracing, locate the Physics and Variables Selection section.
3
In the tree, select Component 1 (Comp1)>Geometrical Optics (Gop)>Release from Boundary 1. This release is not used in the existing study.
4
Add Study
1
In the Home toolbar, click  Add Study to open the Add Study window.
2
Go to the Add Study window.
3
Find the Studies subsection. In the Select Study tree, select Preset Studies for Selected Physics Interfaces>Ray Tracing.
4
Click Add Study in the window toolbar.
5
In the Home toolbar, click  Add Study to close the Add Study window.
Study 2
1
In the Model Builder window, click Study 2.
2
In the Settings window for Study, locate the Study Settings section.
3
Clear the Generate default plots check box. Because an image simulation may involve a large number of rays, some plots may need to adjusted manually.
Step 1: Ray Tracing
1
In the Model Builder window, under Study 2 click Step 1: Ray Tracing.
2
In the Settings window for Ray Tracing, locate the Study Settings section.
3
From the Time-step specification list, choose Specify maximum path length.
4
From the Length unit list, choose mm.
5
In the Lengths text field, type 0 1250.
6
Locate the Physics and Variables Selection section. Select the Modify model configuration for study step check box.
7
In the tree, select Component 1 (Comp1)>Geometrical Optics (Gop)>Release from Grid 1 and Component 1 (Comp1)>Geometrical Optics (Gop)>Release from Grid 2.
8
Right-click and choose Disable. These features are only used in Study 1.
Results
1
In the Model Builder window, click Results.
2
In the Settings window for Results, locate the Update of Results section.
3
Select the Only plot when requested check box. This is to avoid rendering an unnecessarily large number of rays used in an image simulation.
4
In the Home toolbar, click  Compute.
Ray 2
1
In the Model Builder window, expand the Results>Datasets node.
2
Right-click Results>Datasets and choose More Datasets>Ray.
3
In the Settings window for Ray, locate the Ray Solution section.
4
From the Solution list, choose Solution 2 (sol2). This creates a second Ray dataset based on the solution to the new study.
Object Surface
1
In the Results toolbar, click  More Datasets and choose Surface.
2
In the Settings window for Surface, type Object Surface in the Label text field.
3
Locate the Data section. From the Dataset list, choose Study 2/Solution 2 (sol2).
4
Locate the Selection section. From the Selection list, choose Object Plane.
Image Surface
1
In the Results toolbar, click  More Datasets and choose Surface.
2
In the Settings window for Surface, type Image Surface in the Label text field.
3
Locate the Data section. From the Dataset list, choose Study 2/Solution 2 (sol2).
4
Locate the Selection section. From the Selection list, choose Image Plane.
Use the following steps to create a 3D Ray Diagram together with the imported object and the accumulated image.
Ray Diagram 2
1
In the Model Builder window, under Results click Ray Diagram 2.
2
In the Settings window for 3D Plot Group, click  Plot Last.
3
Click the  Zoom Extents button in the Graphics toolbar.
Ray Diagram 3
1
Right-click Ray Diagram 2 and choose Duplicate.
2
In the Settings window for 3D Plot Group, type Ray Diagram 3 in the Label text field.
3
Locate the Data section. From the Dataset list, choose Ray 2.
4
Click to expand the Window Settings section. Locate the Plot Settings section. From the View list, choose New view.
5
Locate the Color Legend section. Clear the Show legends check box.
Ray Trajectories 1
1
In the Model Builder window, expand the Ray Diagram 3 node, then click Ray Trajectories 1.
2
In the Settings window for Ray Trajectories, locate the Extra Time Steps section.
3
In the Maximum number of extra time steps text field, type 25. This will speed up the rendering of the rays.
Color Expression 1
1
In the Model Builder window, expand the Ray Trajectories 1 node, then click Color Expression 1.
2
In the Settings window for Color Expression, locate the Expression section.
3
In the Expression text field, type at(0,im1(qx,qy)). This will color each ray according to the value of the imported bitmap at location it was released.
4
Locate the Coloring and Style section. From the Color table list, choose Thermal.
Filter 1
1
In the Model Builder window, right-click Ray Trajectories 1 and choose Filter.
2
In the Settings window for Filter, locate the Ray Selection section.
3
From the Rays to render list, choose Number.
4
In the Number of rays text field, type 500. This will limit the number of rays that are rendered.
Selection 1
1
In the Model Builder window, expand the Results>Ray Diagram 3>Surface 1 node, then click Selection 1.
2
In the Settings window for Selection, locate the Selection section.
3
From the Selection list, choose Lens Exteriors.
Object
1
In the Model Builder window, right-click Ray Diagram 3 and choose Surface.
2
In the Settings window for Surface, type Object in the Label text field.
3
Locate the Data section. From the Dataset list, choose Object Surface.
4
Locate the Expression section. In the Expression text field, type im1(x,y). This will show the imported bitmap on the object plane.
5
Locate the Coloring and Style section. From the Color table list, choose GrayScale.
6
Click to expand the Quality section. From the Resolution list, choose No refinement.
7
From the Smoothing list, choose None.
Transparency 1
Right-click Object and choose Transparency.
Image
1
In the Model Builder window, right-click Ray Diagram 3 and choose Surface.
2
In the Settings window for Surface, type Image in the Label text field.
3
Locate the Data section. From the Dataset list, choose Image Surface.
4
Locate the Expression section. In the Expression text field, type gop.wall3.bacc1.Inum. This is the value of the accumulated image.
5
Locate the Coloring and Style section. From the Color table list, choose GrayScale.
6
Locate the Quality section. From the Resolution list, choose No refinement.
7
From the Smoothing list, choose None.
Transparency 1
1
Right-click Image and choose Transparency.
2
In the Ray Diagram 3 toolbar, click  Plot.
3
Click the  Show Grid button in the Graphics toolbar.
4
Click the  Orthographic Projection button in the Graphics toolbar. Compare the result to Figure 7.
Next, create a 2D Plot showing the accumulated image together with the imported bitmap.
Object and Image
1
In the Home toolbar, click  Add Plot Group and choose 2D Plot Group.
2
In the Settings window for 2D Plot Group, type Object and Image in the Label text field.
3
Locate the Plot Settings section. Clear the Plot dataset edges check box.
Object
1
Right-click Object and Image and choose Surface.
2
In the Settings window for Surface, type Object in the Label text field.
3
Locate the Data section. From the Dataset list, choose Image Surface. Note that this is actually the Image surface dataset.
4
Locate the Expression section. In the Expression text field, type im1(mag*x,mag*y). This scales and flips the object to match the image.
5
Locate the Coloring and Style section. From the Color table list, choose GrayScale.
6
Clear the Color legend check box.
7
Click to expand the Quality section. From the Resolution list, choose No refinement.
8
From the Smoothing list, choose None.
Deformation 1
1
Right-click Object and choose Deformation.
2
In the Settings window for Deformation, locate the Expression section.
3
In the x component text field, type -50[mm].
4
Locate the Scale section. Select the Scale factor check box.
Image
1
In the Model Builder window, right-click Object and Image and choose Surface.
2
In the Settings window for Surface, type Image in the Label text field.
3
Locate the Data section. From the Dataset list, choose Image Surface.
4
Locate the Expression section. In the Expression text field, type gop.wall3.bacc1.Inum.
5
Locate the Coloring and Style section. From the Color table list, choose GrayScale.
6
Locate the Quality section. From the Resolution list, choose No refinement.
7
From the Smoothing list, choose None.
8
In the Object and Image toolbar, click  Plot.
9
Click the  Zoom Extents button in the Graphics toolbar. Compare to Figure 8.