A fog band softens the horizon only by repainting the ground
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.
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.
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 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.
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.
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.
- What happens behind the eye — both name clip space, homogeneous coordinates, point at infinity, projective map
- A point and a line are one object — both name homogeneous coordinates, point at infinity, projective map
- An angle is a cross-ratio — both name homogeneous coordinates, horizon, point at infinity
- The conic a circle becomes — both name horizon, point at infinity, projective map
- Three conics are one conic and a choice of horizon — both name horizon, point at infinity, projective map
- Two lines at infinity — both name horizon, point at infinity, projective map
Named objects
A flat tag is an object no other essay names yet.
Clip spaceHomogeneous coordinatesHorizonpoint at infinityProjective mapSamplingSampling grid