RayCrafterdocumentation

Simple ray tracing with off-the-shelf optics. Very early software: expect rough edges.

Quickstart

The window

The top part is the side view: the optical axis seen from the side, with light travelling left to right, a brown dashed line for the source plane and a green dashed line for the image plane. The distances between things are written along the bottom. The glyph in the bottom-left corner shows that z runs to the right and y up; every length on the bench is in mm. Below the side view are three groups of plots, each with its own tabs.

The status bar along the bottom gives the image position, RMS spot size, focal length (EFL), back focal length, f-number and Airy radius, and any warnings. While the light leaves the last lens collimated, it describes that beam instead. The button at its right end gives the transmission and pulse dispersion of the lenses.

The main window: tool palette on the left, side view with two achromats and two beams, and spot, MTF and field curvature plots, with transmission and dispersion in the status bar
Two achromatic doublets, with an on-axis beam (blue) and a beam at 3° (green).

Two strips are always on the window:

A new window starts with one lens, an ACT508-200-A achromat.

Example designs

Help → Examples (or File → New from Example) puts one of these on the bench, ready to change:

ExampleWhat it is
Galilean beam expanderA negative and a positive lens that widen a 2.5 mm HeNe beam 4 times
Galilean telescopeA 10× telescope with a negative eyepiece, looked through by a model eye
Keplerian telescopeThe same objective and eye with a positive eyepiece, the eye at the exit pupil
4f scan systemA scan mirror, a Plossl scan lens and a tube lens, with the scanned beams meeting at a back aperture
Basic microscopeAn infinity-corrected microscope made of two paraxial lenses

Tools

Tool palette

Each tool is chosen from the tool palette, and its settings appear in the context bar.

Tool (key)What it does
Move VDrag, select and right-click things on the bench. The normal tool.
Add paraxial lens PPlace ideal thin lenses
Add catalogue lens LFind and place a real lens
Add user part UPlace one of your saved parts
Add aperture APlace a variable aperture (iris)
Add detector DPut a detector on the image plane
Add field RAdd and edit the light entering the bench
FocusNot a tool but a button: autofocus moves the image plane to best focus, once

Esc goes back to Move.

Focus

Focus (autofocus), at the bottom of the tool palette, moves the image plane to the best focus of the selected field. The Lock focus button (the padlock at the right of the context bar) keeps it there as you change the design, as long as that focus is within the side view. You can also drag the green image line.

Light that leaves the lenses collimated has no focus, so the image plane goes somewhere else that means something:

Lock focus moves only the image plane. If there is nowhere for the image plane to go, for instance when the light diverges, it stays where it is.

Lenses

Add a catalogue lens

  1. Choose Add catalogue lens (L). The lens browser appears at the bottom right, and its filters in the context bar: positive and negative lenses, focal length, diameter and coating.
  2. Type part of a part number in the search box (for example AC254), or open the groups, and select a lens.
  3. Click on the axis to put the lens where you want it. Esc or right-click cancels.

By default only lenses whose coating suits the wavelengths of your fields are listed. If a lens you expect is missing, set the coating filter to All coatings.

The lens browser at the bottom right, searching for AC254-1, with its filters in the context bar
The lens browser, searching for AC254-1.

Add an ideal (paraxial) lens

Choose Add paraxial lens (P), set the focal length and diameter in the context bar (the ± button makes a diverging lens), then click on the axis. The tool stays active, so you can place several; the other add tools go back to Move after one. With Move, click a paraxial lens to change its focal length or diameter.

Move, flip and delete

Replace a lens

Right-click a lens to swap it for another without rebuilding the design, for example to turn a sketch made with paraxial lenses into real parts.

Choose in the lens browser and press Replace. The new lens goes where the old one’s rear principal plane was, so a collimated beam still comes to a focus in about the same place. A locked gap next to the lens keeps its length instead. A lens that would overlap a neighbour is refused. For one lens of a Plossl pair you are asked what to do about the pair.

Focal points and snapping

Point at a lens, or select it, to see its focal points F (in front) and F′ (behind), each with its distance from the glass. An assembly is treated as one optic, with one pair of focal points. They are calculated at the selected field’s wavelength.

Two paraxial lenses forming a relay, with F and F prime of the second lens marked
A relay of two paraxial lenses, with the focal points of the second one marked.

Is a plane on a focal point?

Relays and infinity-corrected systems rely on a plane being on a focal point: the source or object plane on F of the first lens, the image plane on F′ of the last, an aperture on F or F′ of the lens beside it. The label of the gap between them says = F or = F′ when it is. When the output is collimated, and comes from beams at two or more angles or from object points, a label on an orange ground, such as 9.2 off F, warns of a plane that is close to a focal point but not on it.

If replacing or flipping a lens, or making a Plossl pair, takes a plane off a focal point it was on, a bar appears above the side view. Move back puts the plane on the new focal point.

A bar above the side view saying the object plane was on F and is now 1.00 mm in front of it, with Move back and Dismiss buttons
The microscope example after its f = 10 mm objective is replaced by a 9 mm one.

Gaps and locks

A gap is the air distance along the axis, from the back of one lens or aperture to the front of the next, or from the last one to the image plane.

Type a gap

Click the gap’s label, enter the distance and press Return. Everything behind it, including the image plane, shifts together, so no other gap changes. A value that would make surfaces overlap, or put the image plane less than 1 mm behind the last element, is refused and the smallest allowed value is shown.

Lock a gap

Right-click the gap’s label and choose Lock gap, or Unlock gap to release it. A locked label has a box round it. Lenses joined by locked gaps move as one.

Side view with a source plane, a single lens, a Plossl pair and locked gaps
A source plane 60 mm in front of the first lens, and a Plossl pair (purple). The boxed gaps are locked.

Let RayCrafter find a gap

Right-click an unlocked gap (not the one to the image plane) to have its length worked out:

Real rays of the selected field are used, and a length that clips rays is never chosen. A window shows the gap and the result before and after; press Apply to accept, with Lock the gap ticked if you want to keep it. If a lens next to the gap would do clearly better the other way round, the window says so and offers Flip and apply. If the best length is at the end of the allowed range, there may be no true solution.

The gap from the source plane can be optimised too, for example to collimate a point source.

Lock the gap to the image plane

The image plane then moves with the last lens. Autofocus and Lock focus are unavailable. Likewise, while Lock focus is on, that gap cannot be typed or locked.

Locked gaps when adding or deleting

Assemblies and user parts

An assembly is a group of neighbouring lenses (and apertures) that moves and flips as one. It is drawn in purple, and pointing at one of its lenses shows the assembly’s name.

Make an assembly

  1. Put the lenses where you want them relative to each other.
  2. Lock the gaps between them.
  3. Right-click one of the lenses and choose Make assembly.

Flip, split or delete

User parts

Plossl pairs

Right-click a positive catalogue lens and choose Make Plossl. RayCrafter adds a second copy of it, turns the two to face each other 1 mm apart, centres the pair where the single lens was and makes it an assembly. The design is then refocused (unless the gap to the image plane is locked). Locked gaps keep their length, and a pair that would overlap anything is refused. The option is not available for a paraxial or negative lens, or one that is already in an assembly. Split assembly separates the two again.

Apertures and the detector

Add an aperture

Choose Add aperture (A) and click on the axis. A new aperture is open: it is drawn a little wider than the light and blocks nothing. Select it with Move and use the slider in the context bar to set its diameter, from 0 (closed) up. The right end of the slider opens it again.

A set aperture blocks the rays outside it. Because it takes up no space, it can be placed or dragged into a locked gap or an assembly, for example at a focus inside a relay, and moves past lenses without pushing them.

Choose the aperture stop

Right-click a lens or an aperture and tick Aperture stop. It is tagged stop in the side view. A design has one stop at most. A lens used as the stop limits the light at its front surface. An open aperture keeps its present size when it becomes the stop, and cannot be opened while it is the stop.

Make the fields fill the stop

Choosing a stop does not change the light. To do that, tick Fields fill the stop in the field panel. Every field’s rays are then aimed so that they just fill the stop, with the chief ray through its centre:

The sliders for the values set by the stop are greyed out and show the calculated values. Closing the stop then narrows the beams rather than blocking most of their rays.

Two beams filling an aperture stop between two paraxial lenses
Two beams filling a 6 mm aperture stop. Both lenses have f = 100 mm. The first is at z = 50 mm and the stop is 50 mm behind it, half-way to where the beams come to a focus (z = 150 mm). Both chief rays pass through the centre of the stop.

The status bar warns you if a field cannot fill the stop (it is then traced as typed; this happens, for instance, if the stop is where a beam comes to a point), or if a lens or another aperture clips the light before the stop does. In a large design with the stop behind many lenses, redrawing is slower.

Mark a back aperture

To see the beams on one lens or aperture, such as the back of an objective, right-click it and tick Back aperture. It is tagged in the side view, and the Back aperture tab shows the light on it. The mark changes no optics.

The detector

A detector is the active area of a sensor on the image plane, such as a camera chip or a photomultiplier. A design can have one, round or rectangular, centred on the axis.

A rectangular detector on a defocused image plane, with the Detector tab showing 100% of one field and part of another on it
A 4 × 3 mm detector behind the focus: all of the on-axis beam lands on it, but little of the other.

The share is of the light that sets out, so light lost at lens rims or apertures counts as lost. It assumes the light is uniform across each beam and ignores losses in the glass; it is good to about half a percentage point. The detector blocks no rays.

Fields and the source plane

Fields (beams)

A field is light entering the bench. Choose Add field (R) to show the field panel at the bottom right.

The field panel: light type, sliders for width, angle, vergence, offset and wavelength, the list of fields, colour settings and rays per field
The field panel.

The spot diagram, side view and detector show every field. The through-focus, MTF, ray fan and field curvature plots, the f-number, Autofocus, gap optimisation and the marked foci use the selected field.

The source plane

A beam’s width, offset, angle and vergence are those it has at the source plane, which can stand for a light source or a scan mirror. By default it sits at the front of the first lens and moves with it.

Move the source plane

Beam offset

Offset is the height of the beam’s centre at the source plane. With an offset of 0, beams at every angle pass through the axis there, as at a scan mirror.

A finite object

Fields are normally beams, from an object at infinity. To image an object at a finite distance, set Light in the field panel to Object points. Every field is then a point on the source plane, now labelled object, with a height (y and x) and a numerical aperture (NA) that sets the width of its cone of light. A design has either beams or object points, not both. If the source plane was on the first lens, switching moves it to the lens’s front focal plane.

With a finite object the status bar also shows the magnification (M) and where the selected point is imaged, and the Distortion plot is available. No f-number is shown.

Example: a basic microscope

Help → Examples → Basic microscope builds an infinity-corrected microscope from two paraxial lenses: an f = 10 mm objective and an f = 200 mm tube lens, with a point on the axis and one 0.5 mm off it. Try replacing the lenses with real ones.

A microscope with an object plane, a paraxial objective and a real tube lens, with the grid distortion plot
The microscope example with a real tube lens and the second point moved to 0.8 mm. Bottom right: grid distortion.

Beginner tools

Two tools for learning the optics, built into RayCrafter.

Teaching overlays

View → Teaching overlays draws the ideas of first-order optics on the side view, for the selected field. Each of the four groups can be switched on by itself:

Point at anything drawn for a one-line explanation. The field’s own rays are faded while an overlay is on. If no aperture stop is chosen, the front of the first lens stands in for it. The web report has the same overlays, behind its Tutorial switch.

Side view with the chief ray, the marginal rays, the stop and the entrance and exit pupils drawn over faded rays
Chief and marginal rays, stop and pupils. The dashed lines carry the rays on to the pupils.
Side view with focal points, principal planes, nodal points and the focal distances marked
Focal points, principal planes and focal distances of a pair of lenses.

Optics tutorials

Help → Optics tutorials opens guided lessons in your web browser. As you step through a lesson, RayCrafter puts each step’s design on the bench, with the plots and overlays it talks about, for you to change and explore. Switch to RayCrafter on the lesson page and Switch to lesson in the window take you from one to the other.

Your own design, named designs and undo history are set aside while a lesson runs, and come back when it ends. During a lesson the named designs are the lesson’s steps.

You can also read the lessons online, without RayCrafter.

Designs and views

Named designs

A project can keep several variants of a design, such as a relay with singlets and the same one with achromats, so that you can switch between them and compare them. Each named design is a whole copy of the bench: lenses, fields, image plane and the rest. The controls are at the right of the context bar.

The design controls in the context bar: a drop-down showing Singlet second, then plus, Update, a menu button and Compare
A web page comparing two designs in columns: focal lengths, spot sizes, ray diagrams, spot diagrams and further plots
The top of a comparison page.

Named designs are saved in the project file.

3D view

View → Show 3D View opens a window showing the lenses and rays in three dimensions. Drag to turn it, or use the 3D, Side, Top and End buttons. It catches up once you stop changing the design.

The Bench list

View → View bench lists the lenses and apertures (with vendor, size and surface numbers), the fields and the image plane. Click a row to highlight that item in the side view. You can delete items and fields from here.

The Bench list showing two lenses, an aperture, two fields and the image plane

The numbers in this list are the ones scripts and AI agents use. They start at 0, and lenses and apertures are numbered together from left to right.

Shortcuts

VMove tool
P, L, UAdd a paraxial lens, catalogue lens or user part
A, D, RAdd an aperture, detector or field
FFlip the lens, or assembly, under the pointer
Delete or BackspaceDelete what is under the pointer
EscCancel placing, and go back to Move
Alt (Option) while draggingDo not snap
Alt (Option) + ←, →Previous, next named design
Ctrl/Cmd + ZUndo
Ctrl/Cmd + Shift + ZRedo (also Ctrl + Y on Windows)
Ctrl/Cmd + N, O, SNew, open, save