Getting started
Ray Bench is a two-dimensional optical bench. Light travels from left to right along the optical axis (the dash-dot line). All lengths are in millimetres.
- Pick a Preset at the top, for example Single lens: 2f–2f imaging.
- Read the Try this notes on the right. Each preset has short exercises.
- Drag the object or a lens along the axis and watch the rays, the image and the numbers change.
- Click any element to edit its focal length, diameter, radii or glass under Elements.
- Use Add under the bench to build your own system from thin lenses, glass lenses, apertures and screens.
Press Fit view whenever the system leaves the screen. Press Screen to image to move the screen to the paraxial image.
Mouse, touch and keys
| Action | How |
|---|---|
| Select an element or the object | Click it on the bench, or click it in the Elements list |
| Move an element along the axis | Drag it left or right |
| Pan the view | Drag empty space |
| Zoom | Mouse wheel, pinch with two fingers, or the + and − buttons |
| Nudge the selected element | ← and → keys (hold Shift for 10× steps). Click the bench first. |
| Delete the selected element | Delete or Backspace, or the Delete button in the editor |
| Open this guide | Help button, or the ? key |
Dragging snaps to a step that depends on the zoom: 1 mm when zoomed out, 0.1 mm or finer when zoomed in. For an exact value, type it into the Position z field.
Vertical × stretches the drawing vertically so thin beams stay visible. Fit view picks a value automatically. Angles on screen are exaggerated by the same factor, but every number in the panel is true.
Elements
- Thin lens
- An ideal lens of zero thickness. Set the focal length f (positive = converging, negative = diverging) and the clear diameter D. It obeys the lens equation exactly and has no aberrations, so it is the right choice for first-order design. The editor also shows its power in dioptres (1000/f with f in mm).
- Glass lens
- A real lens with two spherical surfaces. Set the front radius R1, back radius R2 (0 means flat), centre thickness t, diameter D and glass. Rays are refracted with Snell's law at each surface, so spherical and chromatic aberration appear naturally. The editor shows the focal length and the edge thickness, and warns you if the surfaces cross. Flip lens reverses it.
- Aperture
- An iris with an opening of diameter D. Use it as an aperture stop or a field stop.
- Screen
- A detector of height h. Rays that land on it stop there and are counted in the spot readout. Rays that pass above or below it continue.
Every lens and aperture sits in a mount. A ray that falls outside the clear diameter is blocked and ends with a small dot.
Glasses available: N-BK7 crown, fused silica, F2 flint, N-SF5 flint, or a custom index with no dispersion.
Source and rays
- Object at finite distance
- An upright arrow at position z with height h. Rays leave its tip (warm colour). Tick Also trace the on-axis point to add rays from its base (cool colour).
- Object at infinity
- Collimated beams, as from a star. The field angle θ tilts the off-axis beam. The on-axis beam can be added with the checkbox.
- Ray set
- Fan spreads rays evenly across the aperture stop, so the outermost rays are the marginal rays. Chief + marginal traces three rays per point: the chief ray (thicker) through the centre of the stop and the two marginal rays at its edges. Textbook rays traces the three construction rays from the object tip: parallel to the axis, through the principal point (the centre of a thin lens) and through the front focal point F.
- Wavelengths
- d 587.6 nm traces one colour. F, d, C traces blue (486 nm), yellow (588 nm) and red (656 nm) to show dispersion in glass lenses. Thin lenses have no dispersion.
Reading the drawing
- Image arrow (purple): the paraxial image of the object. Solid = real image, dashed = virtual image.
- I1, I2 …: intermediate images formed between lenses, such as the image inside a microscope tube.
- Virtual rays (faint dashed lines): rays traced backwards to show where a virtual image appears to be.
- F and F′ (diamonds): front and back focal points of the whole system. H and H′ (short dashed lines): the principal planes.
- AS: the aperture stop. EP and XP: the entrance and exit pupils, drawn as brackets showing their size.
- The ruler at the bottom gives z in mm. The numbers on the left give height in mm.
Each overlay can be switched off with the checkboxes under the bench.
Analysis panel
All values in this panel are paraxial (first-order) and use the d-line (587.6 nm).
- Lateral magnification m
- Image height divided by object height. Negative means inverted.
- Angular magnification M
- Shown when the final image is at infinity. For an object at finite distance, it compares the angle seen through the instrument with the angle the object subtends at the 250 mm near point. For an afocal system such as a telescope, it is the ratio of output angle to input angle.
- Visual magnification
- Shown for a virtual image at a finite distance, assuming the eye sits at the last lens.
- Image after each lens
- Where the image would be if the system ended at that lens.
- Effective focal length (EFL)
- Distance from the principal plane H′ to the focal point F′. "∞ (afocal)" means parallel light leaves parallel.
- Back and front focal lengths
- Distance from the last lens surface to F′, and from F to the first lens surface.
- ABCD
- The system ray-transfer matrix from the first lens surface to the last.
- Aperture stop, pupils
- The stop is the element that limits the cone of light from the axial object point. The entrance pupil is its image through the lenses in front of it, and the exit pupil is its image through the lenses behind it. For a telescope, the exit pupil is where you put your eye; its distance from the eyepiece is the eye relief.
- f-number and NA
- f-number = EFL / entrance-pupil diameter (object at infinity). Object-side numerical aperture NA = sin of the half-angle of the cone from the axial point to the entrance pupil.
- Spot on screen
- For each bundle: the mean height where its rays land and the RMS spread in µm. A small RMS means a sharp focus. The count of blocked rays shows vignetting.
Sign conventions
- Light travels toward +z (left to right). Heights y are positive above the axis.
- A surface radius R is positive when its centre of curvature lies to the right of the surface. A symmetric biconvex lens therefore has R1 > 0 and R2 < 0.
- Focal length f > 0 for a converging lens and < 0 for a diverging lens.
- The image distance is measured from the last lens. Positive = to the right (real image). Negative = to the left (virtual image).
- Ray angles u are positive when the ray climbs as it travels right.
Formulas used
Paraxial rays are column vectors (y, n·u) multiplied by 2 × 2 matrices:
| Step | Matrix [A B; C D] |
|---|---|
| Travel distance d in index n | [1 d/n; 0 1] |
| Thin lens, focal length f | [1 0; −1/f 1] |
| Spherical surface, n₁ → n₂, radius R | [1 0; −(n₂ − n₁)/R 1] |
From the system matrix: EFL = −1/C, BFL = −A/C, and F lies D/C from the first surface. For an object a distance s in front of the first lens, the image lies at v = −B/D after the last lens, with m = A + vC (using the object-to-lens matrix).
Thin lens equation: 1/s + 1/s′ = 1/f with m = −s′/s, for distances measured positive on the usual sides.
Magnifier: M = 250/f (image at infinity). Microscope: M = −(L/fobj)(250/feye) with tube length L. Keplerian telescope: M = −fobj/feye.
Exact tracing uses Snell's law, n₁ sin θ₁ = n₂ sin θ₂, applied in vector form at the true intersection point on each spherical surface. Glass index follows n(λ) = A + B/λ², fitted to each glass's catalogue nd and Abbe number.
Presets and exercises
- Single lens: 2f–2f imaging
- The lens equation, magnification, real versus virtual images, and the three construction rays.
- Magnifying glass
- Virtual images and angular magnification 250/f.
- Compound microscope
- Intermediate image, 160 mm tube length, total magnification −100, and the exit pupil (Ramsden disk).
- Keplerian telescope
- Afocal systems, angular magnification, exit pupil and eye relief, field of view.
- Galilean telescope
- An upright image with a negative eyepiece, and its narrow field.
- Spherical aberration
- Lens orientation, stopping down, and the circle of least confusion.
- Chromatic aberration
- Longitudinal colour in a singlet and how the Abbe number controls it.
- Achromatic doublet
- Crown and flint elements cancelling each other's dispersion.
- Aperture stop & pupils
- Which element is the stop, and where the entrance and exit pupils lie.
Lab idea: give students a target (for example "design a 10× telescope at most 300 mm long with a 5 mm exit pupil") and have them build it from the Add buttons, then check their hand calculation against the panel.
Model and limits
- Rays are traced in one plane through the axis (meridional rays). Skew rays and 3D effects such as astigmatism are not modelled.
- Ray optics only: no diffraction, interference or polarisation. Real spot sizes cannot be smaller than the diffraction limit, which this tool does not show.
- Thin lenses are ideal. Only glass lenses show aberrations.
- Mirrors are not included yet.
- Reflections at lens surfaces are ignored. A ray that would be totally internally reflected is stopped.
- The analysis panel is paraxial, so it can differ from the traced rays for fast lenses or wide fields. That difference is the aberration.