Physics & Astronomy
Výuka fyzikyOptikaDisperzeLom světla3D simulaceTypeScript

How a Rainbow Forms – Geometric Optics Simulator

Ray tracing, dispersion in a water droplet, and the formation of primary and secondary rainbows

A geometric optics simulator modeling the refraction and internal reflection of light rays within a raindrop. It illustrates the primary rainbow (deviation angle around 42°) formed by one internal reflection, the secondary rainbow (around 51°) formed by two reflections, and the dark band between them.

/Models/Rainbow/index.html
How a Rainbow Forms – Geometric Optics Simulator interface screenshot
Launch Interactive Simulation

Ray tracing of refraction and internal reflection inside a raindrop

Project Overview & Context

Developed for physics education. Rather than rendering pre-drawn arcs, the model computes ray trajectories through a spherical droplet according to Snell's law and wavelength-dependent refractive indices of water. Users examine single-ray paths at varying impact parameters, caustic ray concentrations, and the spatial distribution of thousands of droplets relative to the observer and the Sun.

Key Features & Capabilities

Single-Droplet Ray Tracing

Step-by-step ray refraction, internal reflection, and emergence with deviation angles and Fresnel intensity calculations.

Ray Bundles & Caustics

Visualization of ray concentration at the critical deviation angle (Descartes angle), producing the characteristic brightness of the rainbow.

Spectral Dispersion

Refraction across visible wavelengths (400–700 nm), illustrating angular separation and spectral order.

Alexander's Dark Band

Geometric illustration of the angular region between the primary and secondary arcs where no singly or doubly reflected rays emerge.

3D Geometry & Observer Cone

3D rendering of the cone of vision centered at the observer's eye, explaining why rainbows appear as circular arcs.

Educational Value & Pedagogical Context

Physics courses often oversimplify rainbow formation to basic prism dispersion. This model clarifies the core principle: a rainbow is not a physical object at a fixed location, but an angular optical phenomenon dependent on sunlight direction and observer position.