Note: This guide is currently under construction.


This calculator will create and analyze simple lens systems using ray-tracing techniques. This is generally useful for imaging systems where diffraction effects aren't important, and the aim is to create an image at a particular magnification, while reducing unwanted aberrations.

Coordinates and Units

Everything happens more or less along the z-axis. Lens positions, the evaluation position, the object position, etc. are all specified in absolute terms, relative to z=0. The origin (z=0) has no special significance; the first optic may be placed at z=0, or the object may be placed there, whichever seems most reasonable to you. Light always propagates in the +z direction.

The units are intended to be millimeters. However, ray optic calculations are scale-invariant, so if the whole system is rescaled by a constant, you would get the same answer. So at present, the units can be anything. Features may be added in the future (such as diffraction-limited spot size) that are not scale-invariant, however.


An object is an arrow, starting somewhere on the z-axis (specified by 'Object Position') with a given height, pointing in the y-direction. An Object is shown below, showing the relevant parameters.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        image/svg+xml                                                                           4 Source Points                 3 Rays per point                                 Angle Range                 z         Lens System      

Some Tips

  • Light always passes through the lenses in the order of the lens list. If the 2nd lens is after the 3rd lens, an error will result.
  • The aperture stop is calculated as the first lens that would block light at the smallest angle emitted from the optical axis.  Consider using a lens of thickness=0, flat/flat, to specify an aperture stop.
  • When optimizing, several rays are generated from each point on the object at various angles such that the central ray goes through the center of the entrance pupil. If the entrance pupil moves during optimization (ie. some lenses before the aperture stop surface are changed), this may give inconsistent results, especially if the 'Fill Aperture' option is selected.  Consider placing a fixed aperture stop as the first optical element to avoid this.
  • Repeatedly hit optimize until the situation stops improving (merit function stops decreasing).
  • Optimization works best if you start fairly near the 'correct' layout. If you have a layout with a magnification of M=-2, and you want M=-20, optimize first for M=-5, then starting from that layout, optimize for M=-10, and then M=-20.
  • Virtual images work; you can place the evaluation plane before the last lens. This will typically give a positive magnification. In the diagram, light appears to be reflected from the last lens and travel to the evaluation plane, but the angle is determined as though it were transmitted light, and it is not affected by lenses it appears to pass.
  • Virtual objects also work; you can place the object after the first lens. The diagram will show rays travelling from the object to the front of the first lens unaffected by any lenses it passes.