Home▸Optics & Light▸2D Snell's Law — Refraction, TIR & Fresnel Intensity

🔻 2D Snell's Law — Refraction, TIR & Fresnel Intensity

A real 2D geometric-optics visualizer: set the incidence angle and the refractive indices of two media, watch Snell's law bend the ray or trigger total internal reflection past the critical angle, and read the live Fresnel reflectance/transmittance plot.

Optics & Light2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-snells-law ↗ Open standalone

About this simulation

This diagram is a real 2D geometric- and wave-optics visualizer for a flat interface between two transparent media. It solves Snell's law, n₁ sinθ₁ = n₂ sinθ₂, to draw the incident, reflected and refracted rays, detects total internal reflection once the incidence angle passes the critical angle, and additionally solves the Fresnel equations for the s- and p-polarized reflection coefficients so you can see exactly what fraction of the light's power is reflected versus transmitted at every angle — something the geometry-only view can't show.

🔬 What it shows

A ray meeting a flat horizontal boundary between Medium 1 (n₁) and Medium 2 (n₂). The refraction angle comes from sinθ₂ = (n₁/n₂) sinθ₁; when that value reaches or exceeds 1, the sim switches to total internal reflection. In parallel it evaluates the unpolarized Fresnel reflectance R = ½(rs² + rp²) and transmittance T = 1 − R at the current angle, and plots R(θ) and T(θ) across the whole 0–89° range as a live curve with a marker at your current setting.

🎮 How to use

Drag the θ₁ slider to set the angle of incidence, or use the n₁/n₂ sliders (or the quick Air/Water/Glass/Diamond dropdowns) to change either medium's refractive index. Presets load common pairings such as Air → Glass or a Fibre Optic setup that sits well past the critical angle. Watch the reflectance curve rise to 100% exactly where the critical angle is marked.

💡 Did you know?

Even with no total internal reflection at all, a plain glass surface at normal incidence (0°) still reflects about 4% of the light back — that's the Fresnel reflectance every window and lens has to fight with anti-reflection coatings.

Frequently asked questions

How is this different from the 3D Snell's Law simulation?

The 3D version renders the same ray geometry in WebGL but only shows angles. This 2D version adds a real Fresnel-equations solver, so it plots exactly how much of the light's intensity is reflected versus transmitted at every incidence angle, not just where the rays point.

What are the Fresnel equations?

They are the exact solutions of Maxwell's equations at a flat dielectric interface for the s-polarized and p-polarized reflection amplitudes: rs = (n₁cosθ₁ − n₂cosθ₂)/(n₁cosθ₁ + n₂cosθ₂) and rp = (n₂cosθ₁ − n₁cosθ₂)/(n₂cosθ₁ + n₁cosθ₂). Squaring and averaging them gives the unpolarized reflectance R, and energy conservation gives the transmittance T = 1 − R.

What happens to the Fresnel curve during total internal reflection?

Once the incidence angle exceeds the critical angle (only possible when n₁ > n₂), there is no real refraction angle, the Fresnel formulas give |r|² = 1, and the plotted reflectance R jumps to exactly 100% while transmittance drops to 0% — all of the incident power returns into medium 1.

Why does even a "transparent" surface reflect some light?

Whenever n₁ ≠ n₂, the denominators and numerators in the Fresnel formulas aren't equal, so rs and rp are nonzero even at normal incidence (θ₁=0°). For an air-to-glass boundary that works out to about 4% reflectance, which is why uncoated glass and camera lenses show a faint reflection.

Is this simulation physically accurate?

Yes for both parts: the ray angles follow Snell's law and the critical-angle formula exactly, and the intensity split follows the full unpolarized Fresnel equations (not an approximation), assuming both media are lossless dielectrics and the beam is a plane wave.

⚙ Under the hood

A real 2D refraction visualizer: aim a light ray at a flat interface between two adjustable media, watch genuine Snell's-law refraction (n1 sinθ1 = n2 sinθ2) and total internal reflection past the true critical angle (arcsin(n2/n1)), and read a live Fresnel-equations plot of reflected vs transmitted intensity as the incidence angle changes, with air/water/glass/diamond presets.

snell's lawrefractiontotal internal reflectionfresnel equationscritical anglegeometric optics2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)