Shape a real glass lens, slide the candle and the screen, and watch where the rays actually go.
Where the ray from height h crosses the axis, measured from the last glass surface: a tilted curve is spherical aberration, curves of different colours that do not lie on top of each other are chromatic aberration.
The science
Ray tracing. At every glass surface the ray is intersected with a sphere (centre xv + R) and refracted with the vector form of Snell's law, n₁ sinθ₁ = n₂ sinθ₂: d′ = η d + (η cosθ₁ − √(1 − η²(1 − cos²θ₁))) N, η = n₁/n₂. Rays are meridional (they stay in the plane of the picture); the spot diagram revolves them around the axis, which is exact for an on-axis source.
Lens-maker's equation (thick lens). 1/f = (n − 1)[1/R₁ − 1/R₂ + (n − 1) t / (n R₁ R₂)]; thin-lens imaging 1/u + 1/v = 1/f, magnification m = −v/u. Real glass breaks both at larger apertures:
Spherical aberration. Rays far from the axis cross the axis closer to the lens. For a single lens it is smaller when the more strongly curved surface faces the more distant point: a plano-convex lens with its flat side first is worse than curved side first.
Chromatic aberration. n depends on wavelength; here a Cauchy fit n(λ) = A + B/λ² (λ in µm) per glass, tuned to published nd and Abbe number Vd = (nd − 1)/(nF − nC) (BK7 64, F2 36, SF11 26, acrylic 57). Blue focuses nearer than red. An achromatic doublet of crown and flint satisfies φ₁/V₁ + φ₂/V₂ = 0, cancelling the colour shift at two wavelengths (leftover is the secondary spectrum).
Prism. Deviation δ = θi + θe − A; it is minimal for symmetric passage: n = sin((A + δmin)/2) / sin(A/2). Blue bends more than red, spreading white light into a spectrum.
Diffraction limit. A perfect lens still blurs a point into an Airy disc of radius 1.22 λ f/D. Compare the spot to the grey circle: when the spot is inside it, the lens is diffraction limited.
Simplifications. Meridional (2D) tracing with spherical surfaces; Cauchy dispersion (accurate to about 10⁻³ in the visible); no reflection losses, coatings, absorption or coma/astigmatism analysis for the off-axis flame image; the flame image on the screen is drawn from the traced chief ray with a blur from the on-axis spot. Not a lens-design tool. Models built with Blender, scene by Three.js.