Fly over a cloud deck with the sun at your back and look down, out ahead of the nose. Somewhere on the cloud tops is a small dark shape the size of your thumbnail: the shadow of your own jet. Around it sits a ring of colour, blue on the inside and red on the outside, sometimes with a fainter second ring beyond. That ring is a glory. Pilots photograph it all the time, and in VIPER 11 it is drawn from the same physics.
A rainbow that points back at you
A glory is always centred on the antisolar point: the spot exactly opposite the sun, as seen from your eye. That is also where your shadow falls, which is why the two always come together. Everyone sees their own glory around their own shadow. A wingman flying 100 m off your wing sees one around his jet and none around yours.
It looks like a rainbow, but it works differently. A rainbow comes from big raindrops bending sunlight through about 138°, and you can explain it with rays and a protractor. A glory is light that comes almost straight back, from cloud droplets a few thousandths of a millimetre across. A droplet that small is only ten to thirty wavelengths of light wide. Light grazing its edge travels around the back of the drop as a surface wave and leaks out heading toward where it came from. The waves leaving different parts of the rim interfere, and each colour reinforces at a slightly different angle. Ray optics can’t produce that at all. You need the full wave solution for a sphere, Mie theory.
The size of the rings is set by the size of the droplets, and nothing else. Halve the droplet and the rings double. They don’t depend on how far below you the cloud is: fly higher and the glory stays the same size on the sky while your shadow shrinks inside it. Typical cloud droplets are 5–15 µm in radius, which puts the first red ring between about 1° and 3.5° from the centre. You see clean, bright rings only when the droplets at the top of the cloud are all nearly the same size. A mix of sizes smears the colours into a pale disc.
Figure 1 · Droplet size and the rings
src/sky/clouds/gloryMie.mjs): Mie scattering by a narrow gamma distribution of droplet radii, every 10 nm from 385 to 725 nm, under a 5,800 K sun, blurred by the sun’s 0.53° disc and seen by the CIE 1931 standard eye. Left, the cloud top 8° around the antisolar point, coloured the way the shader colours it: the cloud’s own light times (1 + 2.5 × the glory). Right, how much brighter each channel is than the cloud 12° away. The game ships one size, 7 µm, typical of the tops of continental stratocumulus.
The shadow
The sun is not a point. It is a disc half a degree across, so every shadow has a soft edge, the penumbra, which widens the further the shadow falls from the object. Past a certain distance there is no point on the ground where the whole sun is hidden at all, only a blur where part of it is. That distance is about 108 times the object’s width.
For a fighter that happens surprisingly close. The F-16’s fuselage is about a metre and a half wide and its wing roots a few metres deep, so the core of their shadow ends 100–400 m behind them. The whole jet, 15 m long and 9.5 m across, hides the full sun out to about 1.6 km. Fly 150 m over the tops and the shadow is a crisp little F-16. At 500 m it is a soft cross. At 1–2 km it is a faint smudge. By 3 km it hides less than a tenth of the sun anywhere and darkens the cloud by a few percent, which is to say it is gone, though the glory around where it was hasn’t changed.
Figure 2 · The shadow with distance

150 m1,500 mHow the game draws it
The clouds in VIPER 11 are marched at a quarter of the screen’s resolution and rebuilt over sixteen frames from the history of earlier ones, shifted to follow the clouds’ motion (the clouds note explains how). The shadow can’t live in there. It moves with the jet at 250 m/s, not with the clouds, and the history would smear it into a streak. So the glory and the shadow get their own small pass, drawn every frame on top of the finished clouds.
The cloud renderer also writes out where the visible cloud top is: the depth at which its light has dropped to half. The new pass runs at half resolution, and only inside the rectangle of the screen that can contain the glory’s 12° cone and the shadow’s axis. For each pixel it works out the angle to the antisolar point and looks the glory up in a table of 97 colours, precomputed with Mie theory exactly as in Figure 1. It then multiplies the cloud’s light by one plus 2.5 times that colour.
That factor of 2.5 is a cheat, and an honest one. A thick cloud deck reflects so much light from many bounces deep inside that the single back-scattered light carrying the glory only changes the brightness by about 15%. The eye, and every pilot’s photo, makes it look stronger, partly because the camera exposes for the bright cloud. In the game, the tone curve also squashes bright cloud tops together. The 2.5 brings it to what the photos show.
For the shadow, the jet itself is drawn once per frame, looking down the sun’s rays, into a 256 × 256 white-on-black mask 64 m across. For a cloud pixel some distance d down-sun of the jet, the pass takes 16 samples of that mask spread over a disc the size of the sun at that distance, from a blurrier copy of the mask the wider the disc is. Their average is how much of the sun is hidden there. That much of the sun’s share of the cloud’s light, 75%, is taken away. The whole thing costs a few hundredths of a millisecond.

“The jet itself” turned out to be the hard part. Until recently, the only F-16 in the game was the cockpit and the part of the nose you can see from the seat. The tail, the stabilators and most of the wings didn’t exist, because nobody ever looked at them. The first shadow had a nose and a pair of flat plates bolted on for the tail. The F-16 now has a full exterior, built procedurally in three.js against a set of reference images. Its simplest distance level sits hidden inside the cockpit, never drawn on screen, and that is what casts the shadow. The F-35C does the same with its own airframe.
Where these pictures come from: the glory lab in the game’s source, which runs the game’s sky, clouds and this pass with the camera at the pilot’s eye and a phone-like lens, over a closed deck with the afternoon sun behind. In the cockpit you see it through the GoPro’s 165° fisheye, where the whole glory is a ring a few dozen pixels across, and it shows up only over a cloud thick enough to backscatter.
A smaller fix: ghosts that weren’t blocky
The same day, the lens got a fix that has nothing to do with clouds, but it is the same kind of problem: a small image magnified until its pixels show. The sun’s flare in VIPER 11 throws ghosts, scaled copies of the bright parts of the frame mirrored through its centre, the way reflections between lens elements do (the lens note has the whole stack). To keep them cheap, every ghost was read from the bloom chain’s bright pass at one sixteenth of the screen’s resolution, through an ordinary bilinear lookup. The small ghosts were fine. The big ones magnified those coarse texels several times over, so they came out as hard-edged polygons and, in the worst frames, stair-stepped copies of cloud edges and the canopy sill.

BeforeAfterThe fix treats a ghost as what it is, a defocused image. The bigger the ghost, the further out of focus, so the bigger ghosts now read from blurrier levels of the same chain (1/32 and 1/64). Because blurring lowers the peaks, their threshold comes down with them, to 55% and 30%. And every read goes through a cubic B-spline instead of a straight bilinear one. A bilinear lookup draws straight lines between texels, which become visible stair steps and diamonds when magnified. The B-spline curves smoothly through them, using four bilinear reads arranged so that the hardware does most of the weighting. The same commit took a similar row of stairs out of the canopy reflection along the cockpit’s edge.
Credit where it is due
The Mie code follows Bohren and Huffman’s classic BHMIE. The glory model and its check come from Philip Laven’s work on simulating rainbows, coronas and glories with Mie theory (Applied Optics, 2003). The game’s rings were checked against an aircraft glory he analysed, whose red rings were 8.2°, 14.6° and 20° across for 9.6 µm droplets; the game’s code gives 7.4°, 15.7° and 23.1°. The CIE colour-matching fit is Wyman, Sloan and Shirley’s (2013).