RayCrafter (dev) vs Zemax
Distortion of a finite object: RayCrafter (dev) against Zemax
Distortion of an object at a finite distance. Since RayCrafter launches the rays of a finite object as Zemax does, to the entrance pupil (raycrafter #220), the rays now match ray by ray (to 1e-16 in slope). Not all matches: the RMS wavefront (up to 0.0024 waves, of 0.47 to 0.87) and the MTF, where the Strehl ratio is 0.01 to 0.05, differ a little (Partial).
The design
Two Thorlabs achromats imaging a finite object 95 mm away (object-space NA 0.05, 555 nm), object heights 0 to 5 mm.

What is tested
The distortion of a finite object, where RayCrafter and Optiland's default (f-tan) disagree by almost a factor of two. Chief-ray heights, the distortion curve and the grid.
Issue: raycrafter #69.
RayCrafter against Zemax
RayCrafter at commit 5ecb2efd of
dev, not the release on PyPI. The .zmx was exported at
d5d3377b.
RayCrafter opens the project itself; Zemax (OpticStudio
24.1.3) the .zmx RayCrafter exported from it.
So a difference may be in the export, in a calculation, or in what a quantity means. Each row is
the largest difference over every field (0 mm, 1 mm, 2 mm, 3 mm, 4 mm, 5 mm).
Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| RMS wavefront, every field | 0.002354 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. | 0.01098 | 0.005 / 0.02 | Partial |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. | 0.01098 | 0.005 / 0.02 | Partial |
All 18 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Zemax reads the aperture, fields, wavelength and afocal setting that were meant | 0 warnings | 0 / 0 warnings | Match |
| Surfaces: thicknesses, gaps and semi-diametersThe project file against the lens data Zemax holds | 0 mm | 1e−09 / 1e−06 mm | Match |
| Surfaces: curvatures and conicsCurvature in 1/mm | 0 | 1e−12 / 1e−09 | Match |
| Refractive index of each glassN-BAF10, N-BK7, SF10, SF5 | 0 | 1e−06 / 0.0001 | Match |
| Rays at the image, ray by ray: positionThe rays that both programs trace and get through: 469 at 0, 469 at 1, 469 at 2, 469 at 3, 469 at 4, 469 at 5 | 1.56e−14 mm | 1e−06 / 0.001 mm | Match |
| Rays at the image, ray by ray: slopedx/dz and dy/dz | 3.25e−16 | 1e−08 / 1e−05 | Match |
| Share of the pupil's rays that get through the aperturesRayCrafter's vignetting analysis against the range that Zemax's rings of rays allow: at 0, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through); at 1, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through); at 2, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through); at 3, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through); at 4, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through); at 5, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through) | 0 % points | 0.5 / 2 % points | Match |
| Chief ray at the image, every field | 2.22e−15 mm | 1e−06 / 0.001 mm | Match |
| Focal length | 0 % | 0.0001 / 0.1 % | Match |
| RMS spot radius, every fieldZemax by Gaussian quadrature, RayCrafter from its spot diagram | 0 % | 0.1 / 2 % | Match |
| Ray fans, tangential and sagittal | 1.69e−14 mm | 1e−06 / 0.001 mm | Match |
| RMS spot against focus, every fieldWhere the two ranges overlap | 0.009999 % of the largest | 0.1 / 2 % of the largest | Match |
| RMS wavefront, every field | 0.002354 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| Strehl ratio, every fieldRayCrafter's Strehl ratio on the pixel grid of Zemax's Huygens PSF, as Zemax reads its own (its largest pixel); Zemax's prints three decimals. | 0.001281 | 0.005 / 0.02 | Match |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. | 0.01098 | 0.005 / 0.02 | Partial |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. | 0.01098 | 0.005 / 0.02 | Partial |
| Grid distortion, largestZemax 0.1508 % | 2.64e−07 percentage points | 0.005 / 0.05 percentage points | Match |
| Distortion against object height | 1.49e−09 percentage points | 0.005 / 0.05 percentage points | Match |
Rays
Both programs trace a hexapolar pupil, with the first point of each ring at +x, so the rays that both trace can be paired one by one: RayCrafter's spot diagram (6 rings) with Zemax's ray trace (12 rings).


RayCrafter's own plots
What RayCrafter's window and report draw, with Zemax's points over them (open markers).













The numbers behind the rows
For the rows that have no plot of their own. Zemax's values are from our own run; RayCrafter's from its analysis of the project.
| First order | Zemax | RayCrafter |
|---|---|---|
| effective focal length mm | 36.58 | 36.58 |
| Field | Chief ray, Zemax (mm) | Chief ray, RayCrafter (mm) | Share through, Zemax (%) | Share through, RayCrafter (%) | RMS spot, Zemax (mm) | RMS spot, RayCrafter (mm) | Strehl, Zemax | Strehl, RayCrafter | Worst ray position difference (mm) | Worst ray slope difference |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 mm | 0 | 0 | 100 | 100 | 0.02205 | 0.02205 | 0.008 | 0.008156 | 9.112e-15 | 1.592e-16 |
| 1 mm | -0.5247 | -0.5247 | 100 | 100 | 0.0214 | 0.0214 | 0.01 | 0.01037 | 1.422e-14 | 3.252e-16 |
| 2 mm | -1.049 | -1.049 | 100 | 100 | 0.01949 | 0.01949 | 0.015 | 0.01552 | 1.373e-14 | 3.119e-16 |
| 3 mm | -1.573 | -1.573 | 100 | 100 | 0.01659 | 0.01659 | 0.02 | 0.02005 | 1.442e-14 | 2.642e-16 |
| 4 mm | -2.097 | -2.097 | 100 | 100 | 0.01344 | 0.01344 | 0.033 | 0.03428 | 1.559e-14 | 2.75e-16 |
| 5 mm | -2.62 | -2.62 | 100 | 100 | 0.0122 | 0.0122 | 0.053 | 0.05291 | 1.192e-14 | 2.955e-16 |
Lens data
The radius and thickness in the project file beside the radius Zemax holds, with Zemax's catalogue and index for each glass.
| Zemax # | Type | Radius, RayCrafter (mm) | Radius, Zemax (mm) | Thickness (mm) | Glass | Semi-diameter (mm) |
|---|---|---|---|---|---|---|
| 1 | Standard (stop) | 62.75 | 62.75 | 4 | N-BK7 SCHOTT, n = 1.518274 | 12.7 |
| 2 | Standard | -45.71 | -45.71 | 2.5 | SF5 SCHOTT, n = 1.676472 | 12.7 |
| 3 | Standard | -128.23 | -128.23 | 10 | 12.7 | |
| 4 | Standard | 33.34 | 33.34 | 9 | N-BAF10 SCHOTT, n = 1.672617 | 12.7 |
| 5 | Standard | -22.28 | -22.28 | 2.5 | SF10 SCHOTT, n = 1.732869 | 12.7 |
| 6 | Standard | -291.07 | -291.07 | 43.9 | 12.7 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-03, on finite_object_distortion.zmx exactly as
exported (0 failed steps). zmx_export.json ties
that file to the project, and the run refuses a file that does not fit it. What is asked for, and
why: zemax_analyses.md; every file:
Zemax_reference_output.
Reproduce
export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac uv run python -m evaluation_tools.from_raycrafter.export_zmx --check finite_object_distortion uv run python -m evaluation_tools.from_raycrafter.compare_zemax finite_object_distortion uv run python -m evaluation_tools.build_summary
18 quantities compared.