HomeOptics & LightTotal Internal Reflection

💎 Total Internal Reflection

Interactive simulation of total internal reflection. Drag the incident ray angle and watch the refracted ray vanish at the critical angle. Explores Snell's law, fibre optics, and diamonds.

Optics & Light3DEasy60 FPS💧 Water
total-internal-reflection ↗ Open standalone

About Total Internal Reflection

This simulation models a single light ray striking the flat horizontal interface between a denser lower medium (refractive index n₁) and a less dense upper medium (n₂). It applies Snell's law, n₁ sin θ₁ = n₂ sin θ₂, to find the refracted angle, and the Fresnel equations to compute reflectance. When the incident angle reaches the critical angle θ₊ = arcsin(n₂/n₁), the refracted ray vanishes and every photon is reflected.

You set the two media using preset buttons (glass 1.52, water 1.33, diamond 2.42, air 1.00) or the n₁ and n₂ sliders, and choose the incident angle θ₁ either with its slider or by dragging directly in the dense medium. The info panel reports θ₁, the critical angle, the refracted angle and the reflectance, while a fibre-optic toggle illustrates light trapped by repeated total internal reflection — the principle that carries internet data and powers endoscopes.

Frequently Asked Questions

What is total internal reflection?

Total internal reflection (TIR) is when light travelling inside a denser medium hits the boundary with a less dense medium at a steep enough angle that none of it refracts through — it is all reflected back. It only happens going from high refractive index to low, and only above the critical angle.

What is the critical angle?

The critical angle θ₊ is the incident angle at which the refracted ray would emerge exactly along the surface (θ₂ = 90°). It is given by θ₊ = arcsin(n₂/n₁). For glass to air the panel shows about 41.1°, for water to air about 48.8°, and for diamond to air only about 24.4°.

How does the simulation decide when TIR happens?

Each frame it computes sin θ₂ = (n₁/n₂) sin θ₁. If that value exceeds 1 there is no real refraction angle, so the code flags TIR, draws only the reflected ray and shows the warning banner. Equivalently, TIR is triggered whenever θ₁ reaches or exceeds the critical angle.

What do the n₁ and n₂ controls change?

n₁ is the refractive index of the dense lower medium and n₂ that of the less dense upper medium. Raising n₁ or lowering n₂ increases the index contrast, which lowers the critical angle and makes TIR easier. The presets jump to common materials; the sliders let you set any value, with n₁ from 1.01 to 3.0 and n₂ from 1.00 to 2.0.

What does the reflectance figure mean?

Reflectance is the fraction of incident light energy that is reflected rather than transmitted. The simulation uses the Fresnel equations, averaging the s- and p-polarised reflectances. At near-normal incidence on glass-air it is only about 4%, rising steeply as the angle approaches the critical angle, where it reaches 100%.

Why does the refracted ray bend away from the normal here?

Because light is moving from a denser medium into a less dense one (n₂ < n₁), Snell's law forces θ₂ to be larger than θ₁. As you increase the incident angle the refracted ray swings closer to the surface, until at the critical angle it lies flat along the boundary and then disappears.

Is the physics in this simulation accurate?

The core relationships are exact: Snell's law and the critical-angle formula are textbook results, and the reflectance uses the genuine Fresnel coefficients for unpolarised light. The visualisation is a simplified 2D ray diagram, so it omits effects such as the evanescent wave, beam width, dispersion and absorption.

What is the evanescent wave?

Even during total internal reflection the electromagnetic field does not stop abruptly at the boundary; a non-propagating evanescent wave penetrates a fraction of a wavelength into the less dense medium and decays exponentially. It carries no net energy across the interface, but it underlies frustrated TIR and devices like fingerprint sensors. This simulation does not draw it.

How do fibre optics use total internal reflection?

An optical fibre has a high-index glass core surrounded by a lower-index cladding. Light injected within the acceptance angle strikes the core-cladding boundary above the critical angle, so it reflects perfectly and zig-zags along the fibre with very little loss. The fibre toggle in this simulation shows that bouncing path.

Why do diamonds sparkle so much?

Diamond has a very high refractive index of about 2.42, giving a small critical angle near 24.4°. A brilliant cut is shaped so light entering the top hits the rear facets above that angle and is totally internally reflected back out through the crown, maximising the return of light and the characteristic fire and brilliance.

⚙ Under the hood

Drag the ray angle past the critical angle and watch total internal reflection occur. Snell law, Fresnel reflectance, fibre optics demo. Choose glass, water, diamond.

Canvas 2DOpticsSnells LawTIRFibre OpticsCritical AngleFresnel

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)