What a machine computes

A fog band softens the horizon only by repainting the ground

Carry the sky's full haze a few rows down into a distance-fogged ground and the step at a walker's horizon is not removed but spread into a ramp, whose steepest row changes by about one and a half over the band's width of the whole rise. Two rows barely move a step of 0.63; softening it to the unaided horizon of an eye 150 metres up takes 32 rows at every visibility from one kilometre to thirty — and repaints all the ground beyond forty metres hazier than it is. The choice between an honest distance fog and a seamless horizon is real. What four rows of band do buy is the shimmer: the last row's saw-tooth falls from 0.061 a column to 0.012.

Worth reading first: The divide is postponed, not avoided · A texture does not interpolate on the page.

A ground and a sky share an elevation, not a distance found that the two sides of a rasterised horizon agree, pixel by pixel, on the elevation of their rays, so a haze painted by elevation crosses the edge without a seam. A fog painted by distance cannot, and should not: a ray one row below a walker’s horizon meets the ground only 1.2 kilometres away, so in twenty kilometres of visibility the ground a row down is nearly clear and the sky above it fully hazed. The step is real — a camera photographing a plain through haze records it — and averaging each pixel over its area, as a camera’s pixel does, reduces it only from 0.85 to 0.69 at thirty kilometres.

The essay ended on a scene that wants both: a ground fog that thickens with distance near the eye, and a haze that depends on elevation far away. The proposed measurement was to blend the two over a band of rows below the horizon — distance fog below the band, the sky’s haze above it, a smooth join between — and to ask how wide the band must be before the horizon’s step is too small to see, and how far the blend then misstates the fog on the ground. If two or three rows were enough, a renderer could have both; if it needed tens, the choice would be real.

It needs tens, and the reason is a single line of arithmetic about what a smooth join is.

A band widens the step into a ramp

The scene is the earlier essay’s: an eye 1.62 metres up, 740 pixels of focal length, the camera rolled three degrees, the ground and sky rasterised along a shared row of horizon vertices with positions snapped to 1/256 of a pixel, every pixel’s fog averaged over sixty-four points of its square. The fog on the ground is distance fog, one minus e to the minus D over L. Within a band of r rows below the horizon it is mixed with the sky’s value of one by a smoothstep in the ray’s depression: all sky at the horizon, all distance fog r rows down, a smooth S between.

Carried 2 rows down into the ground, the sky's haze turns a step of 0.63 at the horizon into a largest row-to-row change of 0.53Fog against rows below the horizon for an eye 1.62 m up with 740 px of focal length and 10 km of visibility. Dashed: fog by distance, 1 − e^(−D/L), which rises from 0.11 a row down to the sky's 1 inside the last row. Solid: the same fog with the sky's haze carried down 2 rows by a smoothstep in the ray's depression, equal to the distance fog below 2 rows and hazier above. Bars: each row's fog averaged over its height: 0.84, 0.25, 0.05, 0.03, 0.03, 0.02 for the six rows nearest the horizon. Rasterised along the whole horizon, the camera rolled 3° and every pixel averaged over 64 points, the largest change between vertically adjacent pixels is 0.529 on average along the horizon and 0.588 at worst. The slider widens the band.00.2500.5000.7501024681012rows below the horizonfogdistance fogblended over 2 rowsvisibility 10 km, eye 1.62 mlargest row step 0.529
Fig. 1 Fog against rows below the horizon at 10 km of visibility. Dashed: the distance fog, which rises from 0.11 a row down to 1 inside the last row. Solid: the sky’s haze carried down 2 rows. Bars: each row’s average — 0.84, 0.25, 0.05 nearest the horizon. Along the rasterised horizon the largest change between adjacent pixels is 0.53, against 0.63 with no band. The slider widens the band.

The dashed curve is the distance fog alone. It sits near 0.1 for most of the rows shown and rises to one only in the last fraction of the row nearest the horizon, which the pixel there averages into a step. The solid curve carries the sky’s haze down two rows. It is smooth, and the bars show what the pixels make of it: the row at the horizon averages 0.84, the next 0.25, the next 0.05, and the step that was 0.63 in one row is now 0.59 between the first two rows and 0.20 between the next. Measured along the whole rasterised horizon, the largest change between vertically adjacent pixels falls only from 0.63 to 0.53.

The slider widens the band. At four rows the largest change is 0.33, at eight 0.17, and the bars become a staircase descending from the sky’s one to the ground’s fog over eight rows. The step has not been removed at any width. It has been spread, and a spread step is a ramp whose rows each carry a share of it.

The steepest row is one over the band

That share has a simple size. A smoothstep that runs from zero to one over r rows has its steepest point in the middle, where it climbs 1.5/r per row. The rise it carries is nearly the whole difference between the sky’s one and the ground’s fog at the band’s lower edge, which for any band of a few rows is the ground’s fog a long way out, close to zero. So the largest change a row sees is about one and a half divided by the band’s width.

To soften a walker's horizon to what an eye 150 m up sees unaided takes a band of 32, 32, 32, 32 rows at 1 km, 3 km, 10 km, 30 km of visibility; two or three rows barely move itThe largest change in pixel-averaged fog between vertically adjacent pixels near the horizon, averaged over where the horizon falls within a row — what a rolled horizon sweeps through along its length — for an eye 1.62 m up with 740 px of focal length, distance fog with the sky's haze carried 0, 1, 2, 4, 8, 16, 32, 64, 128, 256 rows down. 1 km: 0.309, 0.324, 0.345, 0.278, 0.166, 0.089, 0.046, 0.023, 0.012, 0.006; 3 km: 0.493, 0.521, 0.482, 0.326, 0.178, 0.092, 0.046, 0.023, 0.012, 0.006; 10 km: 0.634, 0.638, 0.543, 0.344, 0.183, 0.093, 0.047, 0.023, 0.012, 0.006; 30 km: 0.701, 0.678, 0.562, 0.349, 0.184, 0.093, 0.047, 0.023, 0.012, 0.006. Without a band it is the step at the horizon itself. A smoothstep over r rows spreads a rise of nearly the whole of 1 − F over r rows, and its steepest point climbs 1.5 ÷ r of it in a row, so the largest change falls as one over the band. The dashed line is the largest change an eye 150 m up sees in 10 km of distance fog with no band, 0.048 a row — the soft horizon of a view from the air. Reaching it takes 32, 32, 32, 32 rows; under a hundredth, 256, 256, 256, 256.012481632641282560.0010.0040.010.030.10.31rows the sky's haze is carried down (log of rows + 1)largest row-to-row change in fog (log)an eye 150 m up, unaideda hundredthvisibility 1 kmvisibility 3 kmvisibility 10 kmvisibility 30 kmeye 1.62 m, pixel-averagedaveraged over the horizon's phase
Fig. 2 The largest row-to-row change at the horizon against the band’s width, for visibilities from 1 km to 30 km. Without a band: 0.31 to 0.70. At 2 rows: 0.35 to 0.56. At 32 rows: 0.046 to 0.047, the soft horizon an eye 150 m up sees unaided (dashed). Under a hundredth: 256 rows.

The figure computes the change from one column, averaging over where the horizon falls within a row as the rolled horizon does along its length, and agrees with the full rasterisation to within six per cent where both were run. Without a band the step depends on the visibility, 0.31 at a kilometre and 0.70 at thirty, as the earlier essay found. With a band it soon stops depending on anything but the band: at eight rows the four visibilities give 0.17 to 0.18, and from sixteen rows on they agree within a few thousandths, 0.09 at sixteen and 0.047 at thirty-two. Every doubling of the band halves the steepest row.

Two or three rows barely move the step. At one kilometre a two-row band even makes it slightly larger, because the step it replaces was already spread over a row of the ground’s own rise. Some reference is needed for when the step has stopped mattering, and the earlier essay supplies a natural one. An eye 150 metres up in ten kilometres of haze has no step at all: its ground’s distance fog rises over eleven rows of its own, and its largest row-to-row change is 0.048. No one looking at a view from the air calls its horizon a seam. A walker’s horizon reaches that softness with a band of thirty-two rows, at every visibility. A hundredth, the change a viewer can find in a smooth gradient with care, takes two hundred and fifty-six.

So the earlier essay’s two outcomes are decided in favour of the second. The band needed is tens of rows, not two or three.

The price is paid beyond f·h over the band

A band is free inside the sky and expensive on the ground, because inside the band the ground is painted hazier than its distance says. The band starts at a depression of r rows, which a ray reaches at f·h/r metres — 1,199 metres divided by the band’s width, for this eye and lens — and everything beyond is repainted.

The band's price is paid on the ground beyond f·h/r: carried 2 rows down, the haze leaves ground nearer than 644 m untouched; carried 16, nearer than 80 mFor 10 km of visibility and an eye 1.62 m up, how much hazier the blended fog paints a ground point than the distance fog does, against the point's distance, for bands of 1, 2, 4, 8, 16 rows. Below the band the two agree exactly; the band begins at the depression of 1199 m, 599 m, 300 m, 150 m, 75 m — f·h/r — and the blend departs by more than a hundredth from 1280 m, 644 m, 321 m, 160 m, 80 m out. At a kilometre the departure is 0.00, 0.32, 0.71, 0.85, 0.89; at 3 km, 0.48, 0.66, 0.72, 0.74, 0.74. A wider band hides the step better and falsifies more of the ground — the ground a walker cares least about, the most distant, but over a range that grows as the band does.100 m300 m1 km3 km10 km30 km00.2500.5000.7501distance of the ground point (log)how much hazier the blend paints it than distance does1 row2 rows4 rows8 rows16 rowsvisibility 10 km, eye 1.62 mzero below the band, by construction
Fig. 3 How much hazier the blend paints a ground point than distance does, at 10 km of visibility, for bands of 1 to 16 rows. Zero below the band. Two rows leave the ground nearer than 644 m untouched; sixteen, nearer than 80 m. At a kilometre the excess is 0.32 for two rows and 0.85 for eight.

The curves are zero out to the band’s start by construction and then rise steeply: past the start, the smoothstep’s sky share climbs fast while the distance fog is still small, so the blend paints the ground much hazier than it is. A two-row band repaints the ground from 644 metres out, by 0.32 at a kilometre and 0.66 at three. A sixteen-row band repaints it from eighty metres, and at a kilometre paints it 0.89 hazier than distance fog would — nearly the sky’s own value, on ground that should be clear.

At the thirty-two rows a walker’s horizon needs, the band starts at 37 metres and the repainting is visible by forty. In the picture this is a strip thirty-two rows deep under the horizon, a small fraction of the frame; in the scene it is every piece of ground beyond the end of the street. A building’s foot a hundred metres away, which distance fog at ten kilometres would leave almost perfectly clear, is painted as if it stood in thick haze.

That is the sense in which the choice is real. A renderer can keep the honest distance fog and its step, or it can have a soft horizon and accept a fog that is wrong over most of the distance the picture shows. It cannot have both by blending, because a soft join is a wide join, and a wide join is a large depression, and a large depression on a walker’s ground is a short distance.

An eye’s height changes the price, not the softness

The earlier essay found the step disappearing as the eye rose, because the ground’s own fog rise spreads over f·h/L rows, eleven rows at 150 metres. A higher eye might be expected to need a narrower band.

To soften the horizon to what an eye 150 m up sees unaided, a standing eye needs 32 rows, the ground repainted from 40 m out; an eye 15 m up, 32 rows, the ground repainted from 372 m outThe largest row-to-row change in pixel-averaged fog at the horizon, 10 km of visibility, 740 px of focal length, for eyes 1.62, 5, 15, 50, 150 m above the ground and the sky's haze carried 0, 1, 2, 4, 8, 16, 32, 64, 128, 256 rows down. 1.62 m: 0.634, 0.638, 0.543, 0.344, 0.183, 0.093, 0.047, 0.023, 0.012, 0.006; 5 m: 0.504, 0.531, 0.488, 0.328, 0.179, 0.092, 0.046, 0.023, 0.012, 0.006; 15 m: 0.322, 0.339, 0.358, 0.283, 0.167, 0.089, 0.046, 0.023, 0.012, 0.006; 50 m: 0.137, 0.137, 0.145, 0.166, 0.130, 0.079, 0.043, 0.023, 0.011, 0.006; 150 m: 0.048, 0.048, 0.048, 0.048, 0.062, 0.055, 0.036, 0.021, 0.011, 0.006. Bands needed to bring it down to what the 150 m eye sees with none, 0.048 a row, and the distance beyond which the ground's fog is then repainted by more than a hundredth: 1.62 m, 32 rows, the ground repainted from 40 m out; 5 m, 32 rows, the ground repainted from 124 m out; 15 m, 32 rows, the ground repainted from 372 m out; 50 m, 32 rows, the ground repainted from 1239 m out; 150 m, no band. A higher eye already spreads the distance fog's rise over f·h/L rows of its own — 0.12, 0.37, 1.11, 3.70, 11.10 here — so its unblended step is smaller, and the band it needs starts further out, since f·h/r grows with h.012481632641282560.0010.010.11rows the sky's haze is carried down (log of rows + 1)largest row-to-row change in fog (log)eye 1.62 m upeye 5 m upeye 15 m upeye 50 m upeye 150 m upvisibility 10 kmdashed: the 150 m eye, unaided
Fig. 4 The largest row-to-row change against the band’s width, at 10 km of visibility, for eyes 1.62 to 150 m up. Unblended: 0.63, 0.50, 0.32, 0.14, 0.048. From 16 rows the curves meet. Softening to the 150 m eye’s own 0.048 takes 32 rows at every lower height — repainting the ground from 40 m out for a walker and from 372 m for an eye 15 m up.

Without a band the higher eyes are softer, as the earlier essay found: 0.63 for a walker, 0.32 at fifteen metres, 0.14 at fifty. With a band the curves meet. From sixteen rows on the band’s own smoothstep is the steepest thing in every column, and it is the same smoothstep whatever the eye’s height. Bringing any eye below 150 metres down to the 150-metre eye’s own softness takes thirty-two rows.

What the height changes is the cost. The band starts at f·h/r metres, so a band of thirty-two rows starts at 37 metres for a walker, at 115 for an eye five metres up, at 350 for one fifteen metres up. A drone at fifty metres repaints only the ground beyond a kilometre, which is ground its own distance fog had already mostly hidden. The blend is cheap where the step was small anyway, and expensive exactly where the step was large — a walker’s eye, the case the fog was meant to help.

Four rows quiet the shimmer

There is one thing a narrow band does buy. The earlier essay found the last ground row’s fog running in a saw-tooth along a rolled horizon, because the last ground pixel’s centre falls anywhere from a row below the horizon to just under it, and sees ground anywhere from 1.2 kilometres to unboundedly far.

Along a rolled horizon the last ground pixel's fog jumps 0.061 a column with no band, 0.036 with two rows of blend and 0.012 with four: the band quiets the saw-tooth tooColumns 100 to 400 of the horizon, the camera rolled 3° so it crosses a row every 19 columns, 5 km of visibility, each pixel averaged over 64 points: the fog of each column's ground pixel nearest the horizon, with the sky's haze carried 0, 2, 4 rows down. Mean jump from one column to the next: 0.0609, 0.0365, 0.0119. The saw-tooth comes from the last ground pixel's centre falling anywhere from a row below the horizon to just under it; a band makes the fog change slowly over that row, so where the pixel falls matters less, and the shimmer along a moving horizon fades with the step.00.2500.5000.7501100200300400column along the horizonfog of the ground pixel nearest the horizon, pixel-averagedno band2 rows of blend4 rows of blendvisibility 5 km, roll 3°pixel-averaged
Fig. 5 Columns 100 to 400 of the horizon, rolled 3°, 5 km of visibility: the fog of each column’s last ground pixel, averaged over its area. With no band it jumps 0.061 a column on average; with two rows of blend, 0.036; with four, 0.012.

With no band the last pixel’s fog saw-tooths by 0.061 a column on average at five kilometres of visibility. A two-row band brings it to 0.036 and a four-row band to 0.012, a fifth of what it was. The band makes the fog change slowly across the row the last pixel lives in, so where in that row the pixel’s centre falls matters much less. In a moving picture the saw-tooth is the shimmer along a hazy horizon as the camera rolls, the horizon’s version of the sparkle a texture reaches the horizon as a rate described.

So a four-row band is worth having for its own reason, and its cost is modest in the picture: four rows of ground repainted, from three hundred metres out at this eye height. It does not soften the horizon — the largest change is still 0.33 — but it removes the flicker, which is the part of the step that a camera would not record.

Distance and depression are one variable

The two fogs the earlier essay set against each other look like different quantities, one written in metres and one in angle, and that is what made a blend between them seem like a compromise worth measuring. On a flat ground they are the same variable. A ray depressed e below the horizon meets the ground h/tan e away, so every function of the ground’s distance is a function of its depression, and a distance fog is already an elevation haze — one whose rise from nearly clear to fully hazed is packed into the depressions between a row and the horizon.

So the band was never a mixture of two kinds of fog. It is a choice of a different function of depression: one that rises over r rows instead of a fraction of one. And any function of depression that rises gently enough for a pixel to follow it is, read back as a function of distance, a fog in which distant ground is hazier than its distance says. That is why the cost in the reach figure cannot be engineered away by a cleverer join. The only fogs that meet the sky without a step at a walker’s eye height are fogs that are wrong about distant ground, and the measurement only says how wrong for how soft.

A sky is carried as a direction and a point at infinity is an ordinary vertex showed how one quantity can run from the ground into the sky; this is the limit of what that carrying can do. It can take any function of the ray across the edge exactly. It cannot make a function that changes inside one row change slowly, because the change belongs to the scene, not to the way it is carried.

There is a side effect worth noting, though it was not measured here. A distance fog computed near the horizon reads the ground’s depth exactly where the precision a depth buffer has left is least, so a renderer that takes its fog from a depth buffer rather than from carried attributes adds a quantisation of its own to the step. Inside a band the fog stops depending on that depth.

What a band can and cannot join

Put together, the measurements answer the question the elevation essay left. An elevation haze and a distance fog can be joined across the horizon by a smooth band, and the join is seamless in the strict sense the earlier essays measured: no pixel is lost or claimed twice, and every pixel’s fog is a smooth function of its ray. But a smooth join is not an invisible one. The step at a walker’s horizon is a rise of most of the fog’s range, and a band only spreads it, so its steepest row carries about 1.5/r of it. Two or three rows barely help; thirty-two rows give the softness of a view from 150 metres; and thirty-two rows repaint every piece of ground beyond forty metres.

The general point is that the step was never a fault of the join. A distance fog’s rise to the sky happens over the rows where the ground’s distance runs from about the visibility to infinity, and from a walker’s eye those are a fraction of one row. Any fog that rises more gently is a different fog — one in which distant ground is hazier than distance makes it. The divide is postponed began this sequence by carrying the ground’s attributes so that nothing divides by its depth until the pixel; the fog is the case where the pixel’s own size is what cannot be postponed, because the quantity changes faster than a pixel across the horizon.

A renderer for a walker therefore has three honest choices, not two. It can keep the distance fog and its step, average each pixel’s area as a pixel is not a point prescribes, and add four rows of band to quiet the shimmer — a camera’s horizon. It can paint the whole sky and ground by elevation, which is right for atmospheric haze and seamless by construction. Or it can blend over tens of rows and accept that the ground beyond the end of the street is painted as haze. Which is right depends on the scene; what the measurement removes is the hope that a few rows of blending would make the choice unnecessary.

What the measurement assumes

The join is a smoothstep in depression. Other joins exist. A linear ramp has a smaller steepest slope, 1/r instead of 1.5/r, at the price of a kink at each end; a join that follows the distance fog’s own shape would be steepest where the distance fog is. None of them changes the arithmetic that a rise spread over r rows has some row carrying at least 1/r of it.

The reference for softness is a view from 150 metres. The threshold is a comparison, not a measurement of perception. A viewer looking for the horizon’s edge in a still picture finds smaller changes than that, and the hundredth that takes two hundred and fifty-six rows is closer to what careful inspection detects.

The ground is flat and the fog uniform. A real atmosphere thins with height, so a line of sight’s haze depends on its elevation as well as its length, and a hillside ends the ground before the horizon. Both change where the fog’s rise falls; neither removes the fact that a walker’s ground a row below the horizon is about f·h metres away.

The pixel is a square, averaged. A renderer’s anti-aliasing filter is wider than a pixel, which already spreads the step over two rows or so; it acts like a narrow band of its own, with the same arithmetic and no repainting of the ground beyond its reach.

Still open: whether jitter quiets the shimmer without a band

The shimmer is the one part of the horizon’s step a camera would not record, and four rows of band remove most of it by repainting four rows of ground. A renderer has another tool that costs no repainting at all: it can move each frame’s sample positions by a fraction of a pixel and average successive frames, so that over a few frames every pixel’s fog is averaged over its area even though each frame samples it at a point.

The measurement that settles what that is worth renders the rolled horizon’s last ground row with its sample positions jittered over a stated pattern of sub-pixel offsets, averages over a stated number of frames, and asks how many frames bring the saw-tooth’s jump from a column to the next down to the 0.012 the four-row band reached — and how much of the step’s own size that average keeps, since an area average is what a camera records and the band was not.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Clip spaceHomogeneous coordinatesHorizonpoint at infinityProjective mapSamplingSampling grid