Ray Tracing Lab
Increase it to separate marginal rays from the ideal paraxial focus.
- Object distance
- 230.0 units
- Image distance
- 250.9
- Magnification
- -1.09×
- Image
- real
Model limits: ideal thin elements, one optical axis, no diffraction, absorption, chromatic lens dispersion, or finite aperture. The aberration slider is a qualitative marginal-ray perturbation, not an optical-design solver.
Ray Tracing Optics Lab — Lenses, Mirrors & Prisms
This ray tracing lab lets you drag and configure optical elements — convex lens, concave lens, plane mirror, and prism — on a canvas and trace three principal rays through them using the thin lens equation. The resulting real or virtual image is shown with magnification value labeled. The prism mode disperses white light into rainbow colors. A Thin Lens Equation panel displays 1/f = 1/d_o + 1/d_i and M = −d_i/d_o. Presets cover Simple Magnifier, Telescope, Microscope, and Rainbow Prism.
What you can do in this simulation
- Add convex lens, concave lens, plane mirror, or prism to the canvas
- Drag the object arrow and optical elements to reposition and see image update
- Adjust focal length per lens (−200 to 200 units) with a slider
- Use presets for simple magnifier, telescope, microscope, and rainbow prism
- Read magnification and thin lens equation values from the panel
Concepts covered
geometric optics · thin lens equation · magnification · real and virtual images · dispersion · principal ray tracing
How ray tracing finds an image
Instead of computing where light goes with equations alone, ray tracing follows a few carefully chosen 'principal rays' from the top of the object. For a converging lens, one ray travels parallel to the axis and bends through the far focal point, one passes straight through the lens centre unbent, and one goes through the near focal point and emerges parallel. Wherever those rays cross is where the image forms.
Drag the object in the lab and watch the crossing point move. When the rays meet on the far side of the lens they form a real image you could catch on a screen; when they only appear to diverge from a point behind the lens, you get a virtual image — exactly what a magnifying glass produces.
The thin lens equation
Every image the lab draws obeys 1/f = 1/d_o + 1/d_i, where f is the focal length, d_o the object distance, and d_i the image distance. The magnification is M = −d_i/d_o, so a negative M means the image is inverted. The panel shows all three values updating as you drag.
Try moving the object inside the focal length: d_i turns negative, the magnification jumps above 1, and the image flips to upright and virtual — the magnifier regime. Move it outside twice the focal length and you get the small, inverted, real image a camera sensor sees.
Experiments and presets
Load the Telescope preset to see how two lenses combine to magnify distant objects, or the Microscope preset for high magnification of something close. The Simple Magnifier preset shows the single-lens virtual-image case.
Switch to the prism and send in white light: the lab disperses it into a rainbow because each colour refracts by a slightly different angle — the same physics that makes rainbows and splits starlight in a spectrometer.
Why it matters
Ray tracing is the foundation of every optical instrument — cameras, telescopes, microscopes, projectors, and the corrective lenses in glasses. It is also a core topic in ray optics for CBSE, JEE, NEET, and AP Physics, where drawing the principal rays correctly is exactly what earns the marks.
Building the diagrams interactively here turns an abstract, error-prone exam skill into something you can see and check instantly.
Related simulations
- Optics Lab — Interactive Ray Tracing Sandbox
- Acoustics & Sound Waves — Interactive Simulator
- Angular Momentum Simulator: The Spinning Skater Effect
- Black Hole Simulator — Gravity & Spacetime
- Brachistochrone Curve Simulator - Fastest Ramp
- Buoyancy Simulator: Archimedes' Principle, Float or Sink?
Browse all Physics simulations →
Related reading
- Thin Lenses, Ray Tracing, and Prisms: Free Online Optics Simulations
- Wave Optics in Your Browser: Interference, Diffraction, and Snell's Law
Free to use in your browser — no signup required. Found a bug or have an idea to make it better? Tell us.
Finished experimenting?
Save one completion to this browser's signed guest ledger, or directly to your account when signed in.