The second projection

The render is distorted on purpose

A headset renders a bent picture so its lens can straighten it, which is the lens field's polynomial run backwards and the one place on this site where distortion is introduced deliberately. The round trip closes to a thousandth of a millionth of a pixel, and the price is that one rendered pixel becomes 0.646 delivered pixels at the edge of the field and one at the centre.

Worth reading first: Straight lines that are not · The point you have to stand at.

The lens field treats distortion as a nuisance. A real lens bends straight lines, destroys the cross-ratio, and is the largest systematic error in every measurement made from a photograph — so the field’s work is to model it, fit it and remove it.

A headset does the opposite. Its lens sits a few centimetres from a small panel and is doing a job that has nothing to do with imaging: it moves the panel’s apparent position out to a comfortable focal distance and spreads it across a large angle. Achieving that in a few centimetres of glass means accepting a great deal of distortion, and the accepted solution is not to fix the lens but to render the inverse of it.

So the same polynomial appears twice on this site with the sign of the intention reversed. Here it is not an error to be recovered. It is a specification, and the render is written to satisfy it.

The render is bent so the lens can straighten itThe pale grid is what the eye is meant to receive. The dark one is what the renderer actually draws — the same grid pushed through the inverse of the lens — so that the lens's own distortion undoes it. Every node returns to within 8.0e-13 px of where it started. This is the lens field's polynomial run the other way round, and it is the one place on this site where distortion is introduced on purpose.k₁ = -0.28 · the round trip closes to 8.0e-13 pxpale: what the eye receives · dark: what the renderer drawsthe inner 86% of a 72° frame, where the inverse is exact
Fig. 1 The two grids. The pale one is what the eye is meant to receive; the dark one is what the renderer actually draws, which is the pale one pushed through the inverse of the lens. Every node returns to within 8.0e-13 px of where it started once the lens has done its work.

The same function, used backwards

The lens field carries the Brown–Conrady polynomial:

xd=x(1+k1r2+k2r4)+tangential termsx_d = x\,(1 + k_1 r^2 + k_2 r^4) + \text{tangential terms}

and its inverse, computed by the fixed-point iteration every calibration library uses because there is no closed form — inverting a quintic in rr is not worth doing.

A pre-warp is that inverse applied deliberately. The renderer draws each point where the inverse says it should go; the lens moves it back where the polynomial says; and the composition is the identity. The gate asserts the round trip at 101210^{-12} px over a grid of fifty-four nodes.

That closure is not free and its limits are worth stating, because the phase found one of them while drawing this figure. The iteration is contractive only while the radial factor 1+k1r2+k2r41 + k_1 r^2 + k_2 r^4 stays positive — past that the candidate lens folds the image over itself and there is no point to return. At a 90° frame with k1=0.32k_1 = -0.32 and k2=0.11k_2 = 0.11, the corner of the frame is past it, and the round trip came back 110 px out at one end of the figure’s slider. The inverse is written with that warning attached: the failure at strong distortion is silent — the iteration wanders instead of diverging, and returns a point that is merely wrong.

So the figure draws the inner 86% of a 72° frame, which is the regime the inverse is exact in, and says so in its strip. That is the honest version. The alternative — a wider frame with a tolerance loose enough to accept 110 px — would be a figure asserting that a pre-warp works while drawing one that does not.

A rectangular grid through a lens with k₁ = -0.32The faint grid is what a pinhole would have drawn. The solid one is the same grid through barrel distortion: the centre line is untouched, and the outermost bows by 17.8 px.principal pointk₁ = -0.320, k₂ = 0.110 — barrel distortioncentre line 0e+0 px of sag, outermost 17.8 px
Fig. 2 The lens field’s own picture of the same polynomial, where it is a defect. Barrel and pincushion are the two signs of k₁, and every straight line that is not radial is bent. A headset chooses one of these deliberately and asks the renderer to draw its inverse.

The cost, which is not the residual

The interesting quantity here is not how well the round trip closes — it closes to the noise floor — but what the pre-warp does to the density of samples across the field.

A warp that compresses part of the picture and stretches the rest delivers a non-uniform number of pixels per degree. Measure it directly: take a pair of points half a pixel apart in the rendered image, push both through the lens, and see how far apart they land.

At the centre of the field, one rendered pixel becomes 1.000 delivered pixels. At the edge it becomes 0.646. A ratio of 0.646, so the outer field is delivered at about two thirds the density of the centre — which means a render at uniform resolution is over-sampling the middle and under-sampling the rim, or under-sampling the middle and over-sampling the rim, depending on which one it was tuned for. Either way it is spending pixels somewhere they do not arrive.

The control is a pinhole, where the ratio is exactly 1 and the density is flat. The gate asserts both — the barrel lens’s ratio departs from 1 by more than a tenth, and the pinhole’s does not depart at all — and it asserts the second at a fixed coefficient rather than at the figure’s current one, because the claim is that a pre-warp costs resolution and not that this particular frame’s does.

A pre-warped render does not spend its pixels evenlyOne rendered pixel becomes 1.000 delivered pixels at the centre of the field and 0.493 at the edge — a ratio of 0.493. A uniform render therefore over-samples one part of the field and under-samples the other, which is why headset renderers vary their resolution across the frame. A pinhole gives a flat line at exactly 1.00.2500.5000.750100.2000.4000.6000.8001fraction of the way from the centre of the field to its edgehow many delivered pixels one rendered pixel becomesa pinhole — no pre-warp, flat at 1edge 0.493k₁ = -0.32, k₂ = 0edge ÷ centre = 0.493
Fig. 3 The price as a curve. One rendered pixel becomes 0.646 delivered pixels at the edge of the field and 1.000 at the centre, so a uniform render arrives non-uniform. The flat line is a pinhole, which is the control and the only case where a rendered pixel and a delivered pixel are the same thing.

That non-uniformity is why headset renderers do not render uniformly. Varying the resolution across the frame to match the warp is the direct response to this measurement, and it is a geometric optimisation rather than a perceptual one — it is spending pixels where they arrive rather than where they are looked at, which is a different and simpler argument than the one about the eye’s own acuity.

What the polynomial can and cannot express

A pre-warp is only as good as the model it inverts, and the Brown–Conrady polynomial is a model with a specific shape rather than a universal one. Two of its limits matter here and both are stated in the lens field already.

It is radial and tangential, so it cannot express anything else. A distortion that varies with azimuth in a way that is not a simple tangential term — a lens with an aspheric element slightly off centre, a panel not square to the optical axis — is outside the model, and the residual after pre-warping is whatever part of the real behaviour the polynomial could not reach.

And it is even in rr, which is why a lens destroys the cross-ratio: a projective map is a ratio of linear forms and an even polynomial is not one at any coefficient but zero. That is the fact that makes distortion a genuine departure from projection rather than another projection.

The second one has a pleasing consequence for the pre-warp. Since the distortion is not a projective map, its inverse is not either — so the picture a headset renders is genuinely not a perspective picture of the scene. It is a perspective picture pushed through a non-projective warp, and its cross-ratios are wrong, its straight lines are curved, and no camera could have produced it.

The composition is a projection; neither factor is. That is worth stating plainly because it is the only place on this site where an intermediate object is deliberately not a picture of anything, and the whole design depends on nobody ever looking at it.

Chromatic aberration is the third limit and the one that breaks the tidiness completely. The lens’s distortion is different for different wavelengths, so a single pre-warp cannot correct all of them; the standard response is three warps, one per colour channel, and even that is a three-point sample of a continuous function. There is no coefficient at which the correction is exact for white light, and this site’s machinery — which is monochrome by construction, because it computes geometry — has nothing to say about how well the three-sample approximation does.

The invariant, against the coefficient that destroys itFour collinear points, imaged through a pinhole, return the world's cross-ratio to 2e-16. Through a lens with k₁ = -0.32 they return it 1.28% out. The curve is zero at k₁ = 0 and at no other coefficient, because a radial polynomial is not a projective map.00.50011.502-0.400-0.20000.200k₁departure of the cross-ratio from the world's value (%)pinhole1.28%the pinhole's own error, on the same four points2e-16 — the control
Fig. 4 Why neither factor is a projection. The cross-ratio is destroyed by distortion, monotonically in the coefficient, because the polynomial is even in r and a projective map is a ratio of linear forms. The pre-warped render fails this test as badly as the lens does, in the opposite direction, and the composition passes it exactly.

Why this is not the same as correcting a photograph

Both operations apply the same polynomial and they are not the same operation, and the difference is worth stating because it decides what “correct” means in each case.

Correcting a photograph starts with a distorted picture and produces an undistorted one. The information was already recorded; the correction redistributes it. What is lost is the resampling — pixels that were densely sampled in one part of the frame get spread out, and the result has a resolution that varies even though the input did not.

Pre-warping a render starts with nothing and produces a distorted picture on purpose, so there is no resampling loss at all: every pixel is drawn where it is wanted, once, at full precision. What varies instead is the delivery — the density at which the drawn pixels arrive at the eye.

So the pre-warp is strictly better placed than the correction, and the reason is that a render can be evaluated anywhere. A photograph has already committed to a grid; a render has not. That is a real advantage of synthesised pictures over recorded ones and it is not a large class of advantages — most of the time a render is imitating a recording.

k₁ recovered from 5 bent lines and nothing elseThe fit is never shown the coefficient, the camera or the scene — only which sets of points came from straight edges. It returns -0.280000000 against a true -0.280000, off by 5e-15, and straightens its own input to 4e-13 px.fitted k₁ = -0.280000true -0.280000, off by 5e-15
Fig. 5 And the other direction, from the lens field. Recovering a distortion coefficient from the knowledge that some lines were straight — the plumb-line fit, which is what has to be done when the polynomial is not known in advance. A headset does not need it, because the polynomial is a specification rather than a discovery.

What the composition is a projection of

The question this site always asks. A headset draws a pre-warped picture; a lens distorts it; an eye looks at the result. Is the composite a projection of anything from anywhere?

Yes, exactly, and that is the point of the whole arrangement. The pre-warp is the inverse of the distortion, so the composition of the two is the identity, and what remains is an ordinary pinhole picture viewed from the position the optics put the eye at. The headset’s whole optical design is an argument for a very short viewing distance, and the pre-warp is what makes the picture correct from there.

That is a stronger claim than this site can usually make about a real instrument. A refracted picture has no viewpoint; a lens breaks the invariant; a rolling shutter has no centre. A pre-warped render through the lens it was warped for is a projection through a point, to 101210^{-12} px, because it was designed to be.

The two qualifications are the ones this essay has already made. It holds only where the inverse converges, which is a stated region of the field. And it holds for the nominal lens: the pre-warp is computed from a model, and any departure of the actual glass from that model survives uncorrected, in the same way and for the same reason that an uncalibrated camera’s distortion survives.

The invariant, against the coefficient that destroys itFour collinear points, imaged through a pinhole, return the world's cross-ratio to 2e-16. Through a lens with k₁ = -0.32 they return it 1.29% out. The curve is zero at k₁ = 0 and at no other coefficient, because a radial polynomial is not a projective map.00.50011.502-0.400-0.20000.200k₁departure of the cross-ratio from the world's value (%)pinhole1.29%the pinhole's own error, on the same four points2e-16 — the control
Fig. 6 The measurement that says why the model has to be right rather than close. The cross-ratio — the one quantity a projection preserves — fails under distortion, and the failure grows with the coefficient. A pre-warp computed from a wrong coefficient leaves a residual distortion, and that residual is destroying the invariant exactly as an uncorrected lens would.

Where the two projections in a headset are

The screen field’s framing is that a picture is projected twice — once by the camera and once off the display. A headset has both and its second projection is unusually well specified, which is worth setting out because it is the reason the pre-warp is possible at all.

The optics put the panel at an apparent distance and size: typically a couple of metres away and a couple of metres across, so the panel subtends the ninety-odd degrees the headset advertises. That apparent screen is the picture, and the eye is at a fixed distance from it because the eye is a fixed distance from the lens.

So the second projection’s station point is known in advance and constant, which is what no other display in the field can say. A monitor’s station point depends on how far back a chair is; a phone’s on the length of an arm. A headset’s is a property of the device.

Which is why the render can be pre-warped at all. The warp is computed for one eye position, and correcting for a different one would need the pre-warp recomputed. That is exactly what a headset does when it tracks the eye’s position within the lens, and the fact that it has to is the clearest evidence that the pre-warp is a viewpoint-dependent correction rather than an image-processing step.

A pre-warp is therefore a piece of the same argument the rest of this field makes: it is a correction that only works from one place, applied by a device that guarantees the viewer is at that place. Which makes it the same shape as an anamorph — a projection with its viewpoint enforced — with the enforcement done by a headband instead of by a marked spot on a floor.

A word drawn to be read from 74° off to the sideStraight strokes stay straight and the cross-ratio along each is preserved, which is what makes this a projection rather than a distortion.eye, 74° offgrey: the word before the projectionblack: the same word, projected
Fig. 7 The oldest member of the same family. An anamorph is a picture drawn wrong on purpose so that it is right from one place, and it carries no information about where that place is — the viewer has to be told, or restrained. A pre-warped render is an anamorph whose restraint is the headset and whose correcting optics are two centimetres away.

The correction has to be applied last

A small ordering fact that follows from everything above and is easy to get wrong.

The pre-warp is a map from image coordinates to image coordinates, so it has to be applied to a finished picture. Anything computed before it — the projection, the depth test, the occlusion — happens in the undistorted picture, because those are the operations that need a real projection to work on.

That is not a preference. A depth buffer compares along rays and the rays are the projection’s; a clipper cuts against planes that are planes only in the undistorted picture; and perspective-correct interpolation assumes a projective map, which the warp is not. Every one of the pipeline field’s four departures is defined against a projection, and the pre-warp is the one step that is not a projection at all.

So the order is fixed: project, clip, test, interpolate, then warp. And the warp being last is why it costs resolution rather than correctness — it is resampling a finished picture, so the only thing it can lose is samples.

The one place on this site where distortion is a specification

Worth stating as a closing thought, because it is a genuine inversion of the site’s usual stance and inversions are where the assumptions show.

Every other essay treats a departure from the pinhole as something to be measured, bounded and where possible removed. Refraction is measured as a difference from a pinhole. A lens is fitted so it can be undone. A scroll is measured on what it preserves rather than repaired, but the measuring is still against the pinhole’s battery.

Here the departure is chosen, specified in advance, and satisfied. And the thing that makes it work is exactly the thing that makes the lens field’s fits possible: the departure is a model with parameters, so it can be inverted. A departure nobody has modelled cannot be pre-warped, cannot be corrected, and cannot be compensated for — which is a good general statement of what a model buys, and why the fleet’s habit of generating every figure from a stated rule is worth the trouble.

The render is bent so the lens can straighten itThe pale grid is what the eye is meant to receive. The dark one is what the renderer actually draws — the same grid pushed through the inverse of the lens — so that the lens's own distortion undoes it. Every node returns to within 2.3e-13 px of where it started. This is the lens field's polynomial run the other way round, and it is the one place on this site where distortion is introduced on purpose.k₁ = -0.10 · the round trip closes to 2.3e-13 pxpale: what the eye receives · dark: what the renderer drawsthe inner 86% of a 72° frame, where the inverse is exact
Fig. 8 A gentler lens, where the pre-warp is barely visible and the arithmetic is identical. There is no coefficient at which the correction is unnecessary and none at which it stops being exact — inside the region where the inverse converges, the composition is the identity for every k₁ there is.
The bend is a function of one distanceA line through the principal point is straight to 3e-14 px, whatever the coefficient. Everything else bends, and how much is decided by how far the line passes from that point — not by where it is in the frame.0510050100150how far the line passes from the principal point (px)greatest departure of the line from its own chord (px)through the principal point: exactly zerok₁ = -0.18013.6 px at 163 px off
Fig. 9 And the quantity the lens field measures the whole thing by. How far a straight line sags, against its distance from the centre of the field — the signal a plumb-line fit works on. A pre-warp is that sag introduced deliberately, in the exact amount the lens will take back out.

What links here

Computed from the collection, not written here: the essays that point at this one.

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.

AnisotropyBarrel distortionBrown–ConradyCamera calibrationDemonstrationfield of viewinstrument limitInverse projectionRadial distortionResidual