Back to Blog
Physics

Thin Lenses, Ray Tracing, and Prisms: Free Online Optics Simulations

July 11, 2026 5 min read SciFunLab Team

Interactive optics simulations covering the thin lens equation, Snell's law, Fresnel reflection, total internal reflection, and additive color mixing — all free in your browser on SciFunLab.

Optics is one of those subjects where the equations are simple but the geometry takes time to build up. The thin lens equation is four symbols. Snell's law is four symbols. But knowing what those equations predict for a given setup — whether an image is real or virtual, whether a ray reflects or refracts, what color an RGB mix produces — takes hands-on practice. These four simulations cover the main territory: image formation, refraction and total internal reflection, reflection and polarization, and color mixing.

Geometric Optics: Thin Lenses and Mirrors

Geometric Optics is built around the thin lens equation: 1/f = 1/do + 1/di, where f is focal length, do is object distance, and di is image distance. Magnification follows from m = -di / do — negative magnification means the image is inverted.

Place an object outside the focal length of a converging lens and the simulation draws three principal rays:

  • The ray through the center of the lens, which passes straight through undeviated.
  • The ray parallel to the optical axis, which refracts through the far focal point.
  • The ray through the near focal point, which exits parallel to the axis.

All three rays converge at the same point on the far side — that is where the real image forms. Move the object inside the focal length and the rays diverge after the lens. Extend them backward and they appear to meet on the same side as the object. That is a virtual image: it cannot be projected onto a screen, but it looks magnified and upright. This is exactly how a magnifying glass works.

The simulation includes six scenarios: converging lens at various object distances, diverging lens, concave mirror, and convex mirror. Each one uses the same three-ray construction, which makes the connection between the equation and the geometry explicit. A diverging lens always produces a virtual, reduced, upright image regardless of object distance. A concave mirror can produce either real or virtual images depending on where the object sits relative to the center of curvature.

Bending Light: Snell's Law, TIR, and Prism Dispersion

Bending Light covers refraction through the governing equation: n1 × sin(θ1) = n2 × sin(θ2), where n is the index of refraction and θ is the angle from the normal.

Drag a ray into a glass block (n ≈ 1.5) and the bending is immediate — the ray slows down and bends toward the normal. Switch the materials and watch the degree of bending change. The index of refraction tells you the ratio of the speed of light in vacuum to its speed in that medium.

Increase the angle of incidence when going from glass to air and at some point the refracted ray disappears entirely. This is total internal reflection (TIR), which kicks in past the critical angle: θc = arcsin(n2 / n1). At angles steeper than θc, all the light reflects back into the denser medium. This is the physical principle behind fiber optic cables — light stays trapped inside the glass core because TIR prevents it from leaking out.

Switch to the prism mode. White light enters and splits into a rainbow on exit. Each wavelength has a slightly different index of refraction in glass — a phenomenon called dispersion. Red wavelengths (around 700 nm) bend least. Violet wavelengths (around 400 nm) bend most. You can also enable a fan of rays to watch multiple angles hit the prism simultaneously and see the spread of exit angles.

Reflection: Fresnel Equations and Brewster's Angle

The Reflection simulation goes past the simple rule that angle of incidence equals angle of reflection. At every interface, some light reflects and some transmits, and the fraction depends on the angle and on polarization.

The Fresnel equations describe this precisely for two polarization components. The s-polarized component (perpendicular to the plane of incidence) and the p-polarized component (parallel) reflect differently. At Brewster's angle, given by θB = arctan(n2 / n1), the p-polarized component reflects with zero intensity — only s-polarized light reflects. This is why polarized sunglasses reduce glare from water: the reflection from a flat water surface is predominantly s-polarized, and the glasses block that orientation.

Adjust the angle slider and watch the reflectance for each polarization component. At normal incidence, about 4% of light reflects from a glass surface. As the angle approaches grazing incidence, reflectance approaches 100% for both components. The smooth Fresnel curve between these extremes shows that reflection is not binary — it is a continuous function of angle and polarization.

Color Vision: Additive Mixing and the Visible Spectrum

Color Vision shifts from geometric optics to the perception of light. The visible spectrum runs from about 380 nm (deep violet) to 700 nm (deep red), and the simulation maps each wavelength to its corresponding perceived color.

Additive color mixing is what happens when colored lights overlap. Red + Green + Blue (RGB) at full intensity produces white. Red + Green produces yellow. Green + Blue produces cyan. Red + Blue produces magenta. This is how screens work — your monitor mixes three narrow-band light sources at different intensities for each pixel.

The simulation also models the three cone types in the human eye (S, M, and L for short, medium, and long wavelengths) and shows their sensitivity curves. Color blindness modes let you see how a missing or shifted cone type changes color discrimination. Protanopia (missing L cones) makes reds appear very dark. Deuteranopia (missing M cones) shifts the green-red boundary.

Subtractive mixing (CMY) is included as a contrast. Pigments work by subtracting wavelengths: cyan absorbs red, magenta absorbs green, yellow absorbs blue. Mixing all three absorbs most visible light and produces black. This is the opposite of additive mixing, and the simulation makes the distinction concrete.


All four simulations are free to use with no login required. Start with Geometric Optics if you are working through a lens unit, or Bending Light if you are starting from refraction. The physics connects across all four — each one builds on the same underlying model of how light behaves at an interface.

Try them all:

More Physics Articles