🔵 Rayleigh Scattering — 2D Photon Simulator

A Monte Carlo companion to the 3D Rayleigh scattering sky: instead of painting a gradient, this version traces real individual photons at seven wavelengths through an atmosphere, lets each one roll a genuine 1/λ⁴ scattering probability at every step, and builds the sky and sunset colours from the actual tally of what scattered and what survived.

🔬 What It Demonstrates

Rayleigh scattering intensity follows 1/λ⁴: blue light (450 nm) scatters roughly 5.5× more than red (700 nm) per unit path. Here that ratio is not assumed — it emerges from thousands of independent per-step dice rolls, one photon at a time, visibly thinning the blue lane while the red lane keeps marching through.

🎮 How to Use

Drag the sun elevation slider toward the horizon to lengthen the atmospheric path — watch the red lane start scattering too as the sunset tally reddens. Raise the particle density to make every lane scatter faster. Reset the tally at any time to start the statistics fresh.

💡 Did You Know?

This is exactly how physicists validate a scattering law numerically: run a Monte Carlo radiative-transfer simulation and check that the emergent statistics match the analytic 1/λ⁴ prediction, rather than trusting the formula alone.

About this simulation

Written by MySimulator Team · Reviewed by MySimulator Editorial Review

Last updated: 13 September 2026

This model traces individual photons through a two-dimensional atmosphere instead of computing a colour formula directly. Seven visible wavelengths each get their own continuous stream of photons; at every discrete step along the path a photon rolls a genuine scattering probability proportional to 1/λ⁴. The sky colour you see is the live, running average of every photon that actually scattered; the sun/sunset colour is the running average of every photon that actually made it through unscattered. Nothing about the final colour is hand-set — it is the emergent result of thousands of independent random trials, the same Monte Carlo method used to validate radiative-transfer physics numerically.

🔬 What it shows

Seven wavelength lanes (400–700 nm), each a continuous stream of moving photon dots. Every step, every photon rolls dice against a real per-step scattering probability derived from σ(λ) = (550/λ)⁴. Scattered photons visibly peel off into short radiating bursts and are tallied into the sky-colour accumulator; survivors reach the far side and are tallied into the sun/sunset accumulator.

🎮 How to use

Drag "Sun elevation" toward the horizon to lengthen the atmospheric path (air mass), which needs more steps to cross and scatters even the red lane. Raise "Particle density" to make every wavelength scatter faster at a fixed path length. "Reset tally" clears the running counts so you can watch the statistics build up from zero.

💡 Did you know?

This is a genuine Monte Carlo radiative-transfer simulation in miniature: real physicists check an analytic scattering law by tracing large numbers of individual photon histories and confirming the emergent statistics match the 1/λ⁴ prediction, exactly what the live tally here is doing in your browser.

Frequently asked questions

How is this different from the 3D Rayleigh Scattering sim?

The 3D sim paints an analytic sky gradient directly from the closed-form Beer–Lambert transmission formula. This 2D version does not compute colour directly at all — it traces individual photons step by step, has each one roll a real per-step scattering probability, and only then builds the sky and sunset colours from the resulting tally of scattered versus surviving photons.

How is this different from the 2D Atmospheric Optics sim?

The 2D Atmospheric Optics sim also renders a Rayleigh sky, but analytically, alongside an unrelated ice-halo scene. This sim has no halo and no analytic gradient — its only mechanic is per-photon Monte Carlo scattering, where the sky and sunset colours are literally counted, not painted.

What is the 1/λ⁴ law?

Rayleigh's law says scattering intensity is inversely proportional to the fourth power of wavelength. A 450 nm blue photon is about 5.5× more likely to scatter per unit distance than a 700 nm red photon. In this simulator that ratio shows up as a real difference in scatter probability rolled every step, not as a pre-set number.

Why does the sunset tally turn red as elevation drops?

Lowering the sun lengthens the atmospheric path length using the Kasten–Young air-mass approximation. A longer path means more steps, so even red photons — which rarely scatter per step — eventually start scattering too. The survivors that make it all the way through skew increasingly red, exactly like a real sunset.

Is this a real Monte Carlo simulation?

Yes. Each photon's fate (scatter or survive) is decided independently by a random draw against a physically derived per-step probability. The displayed colours are running frequency counts of those draws, which is the same method used in radiative-transfer physics to verify scattering laws numerically.