Ray Optics Simulator โ€” mirrors, lenses, prisms, beam splitters & gratings

Click an object to select ยท Drag to move ยท Del to remove
Ray Optics Concepts

Reflection & Mirrors

The law of reflection states that the angle of incidence equals the angle of reflection. Curved mirrors focus parallel rays to a focal point (concave) or appear to diverge from one (convex). Parabolic mirrors eliminate spherical aberration.

Snell's Law & Refraction

When light crosses a boundary between media: n1 sin ฮธ1 = n2 sin ฮธ2. Glass (n โ‰ˆ 1.5) bends light toward the normal on entry. When the internal angle exceeds the critical angle, total internal reflection occurs.

Fresnel Equations

At every interface, some light reflects and some transmits. The Fresnel equations give the exact ratio depending on angle and polarization. At normal incidence on glass, about 4% reflects. At grazing angles, reflection approaches 100%.

Dispersion & Prisms

Refractive index varies with wavelength: n(ฮป) = A + B/ฮปยฒ (Cauchy equation). Shorter wavelengths (blue/violet) bend more than longer ones (red). A prism separates white light into a spectrum. This is chromatic dispersion.

Thin Lens Equation

For ideal lenses: 1/f = 1/v โˆ’ 1/u, where f is focal length, v is image distance, u is object distance. Converging lenses (f > 0) form real images when the object is beyond the focal point. The simulator's ideal lens uses this equation directly.

Diffraction Gratings

A grating with line spacing d diffracts light according to d(sin ฮธout โˆ’ sin ฮธin) = mฮป, where m is the order number. Different wavelengths diffract to different angles, producing a spectrum similar to a prism but with sharper separation.

Frequently Asked Questions
How do I simulate ray optics online for free?

Use this Ray Optics Simulator: choose a preset or add optical elements (mirrors, lenses, prisms, beam splitters) from the toolbar. Drag objects to position them and the simulator traces rays in real time using Snell's law. No download or signup needed.

What is total internal reflection (TIR)?

TIR occurs when light travels from a denser medium (glass, n=1.5) to a less dense medium (air, n=1) at an angle exceeding the critical angle, arcsin(n2/n1). Beyond this angle, 100% of light reflects. Try it with the Glass Slab or Prism presets.

How does a prism create a rainbow?

Different wavelengths bend by different amounts (dispersion). Red bends less, violet bends more. When white light enters a prism, Snell's law with wavelength-dependent refractive index separates the colors. Load the "Prism Rainbow" preset to see this.

What are Fresnel equations?

Fresnel equations calculate reflected vs. transmitted light fractions at an interface. Enable the "Fresnel" toggle in the controls row to see partial reflections at glass surfaces โ€” some light reflects while the rest transmits, with brightness proportional to the Fresnel coefficients.

What optical elements are available?

19 elements: sources (point, parallel beam, single ray), mirrors (flat, curved, parabolic, ideal), refractors (glass slab, prism, circle lens, spherical lens, ideal lens), beam splitter (with dichroic option), diffraction grating, GRIN lens, blockers (flat, aperture, circle), and observer.

Can I build a telescope or microscope?

Yes. Load the Telescope preset for a two-lens refracting telescope. For a microscope, place two converging lenses with appropriate focal lengths and spacing. Add light sources and apertures to complete the optical system.

What is a GRIN lens?

GRIN (Gradient-Index) lenses have a refractive index that varies across the material, typically decreasing from center to edge. This bends rays continuously inside the lens without curved surfaces. The simulator uses Euler step integration to trace rays through GRIN media.

Is this free for students and teachers?

Yes, completely free with no signup. Runs entirely in your browser. Ideal for physics courses covering geometric optics. Students can experiment with presets and build custom scenes. Teachers can export as PNG for presentations and worksheets.