Web Simulation 

 

 

 

 

Lens Simulator Tutorial 

This tutorial visualizes how a thin lens forms an image. The simulator focuses on the mechanism: principal rays, focal points, image distance, magnification, and what a screen sees when it is not exactly at the image plane.

Mathematical Foundation

The simulator uses the thin-lens approximation. The lens is treated as a single vertical optical element, so refraction is summarized by one focal length f:

1/f = 1/do + 1/di  →   di = 1 / (1/f − 1/do)
m = −di / do,   hi = m ho

Here d_o is object distance, d_i is image distance, h_o is object height, and h_i is image height. In this simulator f is not set directly — it is calculated from lens type, curvature, and refractive index. A positive f is a converging lens; a negative f is a diverging lens.

Real Image And Virtual Image

If d_i > 0, rays physically meet on the far side of the lens and the image is real. If d_i < 0, the outgoing rays spread apart and only their backward extensions meet; the image is virtual.

Worked example: f = 120 mm, do = 220 mm, ho = 45 mm.

d_i = 1 / (1/120 − 1/220) = 264.0 mm
m = −264.0 / 220 = −1.20
h_i = −1.20 × 45 = −54.0 mm

The image is real, inverted, and larger than the object.

Principal Ray Mechanism

The simulator draws three standard construction rays from the top of the object:

  1. Parallel ray: a ray parallel to the optical axis refracts through the far focal point for a converging lens. For a diverging lens, it exits as if it came from the near focal point.
  2. Center ray: a ray passing through the lens center continues straight in the thin-lens model.
  3. Focal ray: a ray aimed through the near focal point exits parallel to the optical axis for a converging lens. For a diverging lens, the comparable construction uses the far focal point.

Where these rays meet, or where their dashed backward extensions meet, is the image location.

Aperture, Screen, And Blur

The aperture limits how wide the ray bundle can be. A larger aperture admits more rays and gives more brightness, but the screen must be close to the correct image plane to look sharp. If the screen is moved away from d_i, the simulator shows a blur spot:

blur diameter ≈ aperture × |screen − di| / |di|

Curvature And Lens Material Index

In a real lens, stronger surface curvature and larger refractive index both increase bending power. A simplified lensmaker-style relationship is power ∝ (n − 1) × curvature. This simulator uses a fixed reference focal length of 120 mm at n = 1.50 and curvature = 1.00; the displayed focal length is calculated, not directly set:

f = fref / (curvature × ((n − 1) / 0.50))

For example, with fref = 120 mm, curvature = 1.20, n = 1.60: f = 120 / (1.20 × ((1.60 − 1) / 0.50)) = 83.3 mm. So higher n or higher curvature moves the focal point closer to the lens.

curvature = 1.00, n = 1.50 → f = 120.0 mm
curvature = 1.50, n = 1.50 → f = 80.0 mm
curvature = 1.00, n = 1.75 → f = 80.0 mm

Curvature changes the shape of the drawn lens; refractive index changes how strongly the material bends the ray. Both affect the calculated focal points F1 and F2.

Simulation

The interactive simulator is below. Use the controls to explore the concepts described above.

f > 0
calculated from curvature and n
120 mm
220 mm
45 mm
120 mm
1.00
1.50
265 mm
3 rays
drag object or screen marker
calculated focal length: f = 120 / (curvature * ((n - 1) / 0.50)) Change Curvature or Lens n to move F1/F2.

Interactive Ray Diagram

optical axis lens / focal points physical rays virtual extensions image / screen

Formula And Status

 

Usage Instructions

  1. Change lens type: Use convex to make rays converge. Use concave to make outgoing rays diverge and form a virtual image.
  2. Move the object: Drag the object arrow or use the object-distance slider. Watch how d_i, magnification, and image orientation change.
  3. Move the screen: Drag the green screen line. When the screen is near the computed image plane, the blur spot becomes small.
  4. Change aperture: Increase aperture to widen the accepted ray bundle. This makes defocus blur easier to see when the screen is not at the image distance.
  5. Read focal length as an output: The focal-length field is calculated. It updates when Curvature, Lens n, or Lens type changes.
  6. Change curvature: Higher curvature makes the drawn lens more strongly curved and shortens the effective focal length in this educational model.
  7. Change lens n: Higher refractive index bends rays more strongly, so the focal point moves closer to the lens.
  8. Compare ray modes: Principal rays explain the construction. Aperture bundle shows many rays passing through the finite aperture.
  9. Animate: Use Step Fwd, Step Bwd, or Run to move light markers along the rays.

Important Simplifications

This is a paraxial thin-lens simulator built to make the image-formation mechanism visible and interactive. It omits many real-optics effects:

  • Thin-lens, paraxial only. The lens has zero thickness and rays are assumed near the axis (small angles). Thick-lens surfaces, principal planes, and large-angle rays are not modeled.
  • No aberrations. Spherical aberration, coma, astigmatism, field curvature, and distortion are absent — a real lens never forms the ideal point image shown here.
  • Monochromatic. Chromatic dispersion (focal length varying with wavelength) is ignored, so there is no color fringing.
  • Geometric optics only. Diffraction and the wave nature of light are not modeled; the blur estimate is a simple geometric defocus formula, not a true point-spread function.
  • Idealized focal-length model. f = fref / (curvature·((n−1)/0.5)) is a teaching relationship, not the full lensmaker's equation with two surface radii.
  • No surface/coating effects or sensor. Reflection losses, anti-reflection coatings, and sensor sampling/pixelation are not represented.