Through water and glass

What survives a pane of glass

A slab of glass moves every point of a picture and moves no direction at all. So the camera recovered from a photograph taken through a display case is exactly the camera that took it — out of a picture in which nothing is where it was.

Worth reading first: What a ray does at a surface · Recovering the camera from the picture it drew.

The previous essay was demolition: a picture taken through water is not a projection of anything from anywhere, and the invariant the site is built on comes back one and a quarter per cent out.

This one is the opposite result from the same machinery, and it is the more surprising of the two. Put glass in the way with air on both sides of it — a shop window, the front of a museum case, a pane in a door — and something is preserved exactly. Not approximately. Exactly, to the last bit a double can hold.

What survives is every direction. What does not survive is every position.

A case front 25 mm thick, with and without itEvery point has moved — by up to 4.5 px — and every vanishing point has not, to 4e-6 px. So the camera recovered from this picture's own vanishing points is the camera that took it, to 4e-10 relative, out of a picture in which nothing is where it was.no single viewpoint — the rays miss by 4.5 px, depth-dependentf recovered from it: 396.88 px
Fig. 1 A tabletop and a box behind a 25 mm case front, drawn with and without it. Every point has moved, by up to 4.5 px; every vanishing point has not, to 4e-6 px. The camera recovered from this picture’s own vanishing points is the camera that took it, to 4e-10 relative.

Why a slab is different

Trace a ray into a slab and out again. It refracts toward the normal on the way in, travels through the glass at the shallower angle, and refracts away from the normal on the way out — by exactly the amount it was bent by on the way in, because the two interfaces are parallel and the media on either side are the same.

So the emergent ray is parallel to the incident one. It is not the same ray: it has been shifted sideways by

s=t sin⁡(θ1−θ2)cos⁡θ2s = t\,\frac{\sin(\theta_1 - \theta_2)}{\cos\theta_2}

where tt is the thickness and θ2\theta_2 the angle inside the glass. For a 25 mm case front in crown glass at 35° incidence that is 5.99 mm.

Everything in this essay is a consequence of those two sentences. Direction preserved, position not.

The consequence for vanishing points

A vanishing point is the image of a direction. It is the limit of the images of points marching away along that direction, and it depends on nothing else about them — not on where the line starts, not on how far along it anything is.

Marching out along a direction, the ray from the receding point to the pinhole tends to a fixed direction, and the slab’s lateral shift tends to a fixed length. A fixed length matters less and less as the point recedes, and in the limit it does not matter at all. So the vanishing point through the glass is the vanishing point without it.

The figure measures this the honest way rather than substituting the closed form. A point is marched out to forty million metres along each of three world directions and photographed through the glass, and the resulting mark is compared with the vanishing point the pinhole camera computes. They agree to 4e-6 px, and the residual is bisection precision in the layered-ray solver rather than anything geometric.

Meanwhile every finite point on the tabletop has moved by up to 4.5 px.

Deriving the displacement, because it is three lines

The lateral shift is quoted often enough to be worth deriving rather than looking up.

Set the slab’s faces at z=0z = 0 and z=tz = t, and send in a ray at θ1\theta_1 to the normal. Inside, it runs at θ2\theta_2 with sin⁡θ1=nsin⁡θ2\sin\theta_1 = n\sin\theta_2, and it crosses the thickness while moving sideways by ttan⁡θ2t\tan\theta_2. Had the slab not been there, the same ray would have crossed the same thickness while moving sideways by ttan⁡θ1t\tan\theta_1. So the emergent ray is displaced along the face by

t(tan⁡θ1−tan⁡θ2)t(\tan\theta_1 - \tan\theta_2)

and the perpendicular displacement — the shift measured across the ray, which is the quantity usually quoted — is that times cos⁡θ1\cos\theta_1, which tidies into tsin⁡(θ1−θ2)/cos⁡θ2t\sin(\theta_1-\theta_2)/\cos\theta_2.

Two features are worth reading off it. It is zero at normal incidence, so a slab does nothing at all to a ray down its own axis — which is why looking straight through a window shows nothing amiss. And it grows without bound relative to the thickness as θ1\theta_1 approaches 90°, so a grazing view through a pane displaces a great deal. The picture the two facts make together is a radial pattern: nothing at the centre of the frame, growing outward — which is why the effect looks, at a glance, exactly like the radial distortion of a lens, and is not.

The giveaway is the same one as in the water case. A lens’s distortion is a function of the image point alone. This is not: change the object’s distance without moving its image point and the displacement changes.

To first order, a slab is a magnification

The radial pattern the section above describes has a leading-order form, and writing it down turns “looks like distortion and is not” into a test a reader can apply to the picture alone.

Near the axis, θ2≈θ1/n\theta_{2} \approx \theta_{1}/n, so the lateral shift is s≈t θ1(1−1/n)s \approx t\,\theta_{1}(1 - 1/n). A shift ss at distance zz subtends s/zs/z at the camera, which is fs/zf s/z pixels; and since fθ1f\theta_{1} is just the mark’s own radius rr from the principal point,

Δr≈tz(1−1n)r.\Delta r \approx \frac{t}{z}\left(1 - \frac{1}{n}\right) r.

Linear in rr — which is to say not a distortion at all, but a magnification. Every mark at one depth is pushed outward in proportion to how far out it already is, and a map that scales an image uniformly is a change of focal length rather than a departure from projection.

That is the familiar apparent-depth result arriving from the image’s side: a slab makes everything behind it appear t(1−1/n)t(1 - 1/n) closer, which for 25 mm of crown glass is 8.55 mm, and an object appearing closer is an object drawn larger by z/(z−8.55 mm)z/(z - 8.55\,\text{mm}). At 0.9 m that is a magnification of 1.0096; at 0.2 m, 1.045.

Two things follow, and the second is the test.

It explains why vanishing points survive without any limit argument. The magnification factor is 1+t(1−1/n)/z1 + t(1-1/n)/z, which goes to exactly 1 as zz grows. A point at infinity is magnified by one, so it does not move — and the whole result of this essay is that statement evaluated at z=∞z = \infty.

And it separates a slab from a lens by the shape of the radial profile. A lens displaces a mark by k1r3/f2k_{1}r^{3}/f^{2}, cubic in the radius: almost nothing near the centre, a great deal at the rim. A slab displaces it linearly: proportionally the same everywhere in the frame. So a picture whose marks are displaced in proportion to their radius has glass in front of it and a picture whose marks are displaced as the cube has a lens, and the two are distinguishable from the pattern without knowing any depth at all — which is a stronger diagnostic than the depth-dependence test, because a reader of a photograph has the radii and does not have the depths.

The linear term is leading-order rather than exact, and the exact shift departs from it at the rim, where tan⁡θ\tan\theta outruns θ\theta. That departure is a cubic correction, so a thick slab viewed steeply does acquire a small genuine distortion on top of its magnification — which is why the sensor cover glass of the last section is a lens-design problem rather than a scale factor, and why a lens computed for one stack thickness misbehaves on another.

A family of parallel ground lines at 66°, and where they meetAll five lines pass through one point on the horizon, off the edge of the frame at x = 5500. The point fitted from the drawn lines agrees with the one computed from the direction to 5e-12 px, and the fit's own residual is 6e-13 px.horizon — the image of the line at infinityvanishing point at x = 5500 — off the framecorrect from 20 cm, at 160 mm wide44° across
Fig. 2 The half of the picture the magnification cannot touch. Five parallel ground lines, photographed through the same camera, meet off the frame at x = 5,500 — eight canvas widths out — and the point is fitted from the drawn lines with a residual of 6 × 10⁻¹³ px. A radial magnification moves every one of those lines and leaves their meeting direction exactly where it was, which is why a slab is invisible to everything downstream of a vanishing point.

Which recovery survives, and which does not

This site has two recoveries and they are now cleanly separated by one pane of glass.

The camera recovery reads only vanishing points. Three mutually orthogonal world directions give three vanishing points; the principal point is their triangle’s orthocentre and the focal length falls out of f2=−(v1−p)⋅(v2−p)f^2 = -(\mathbf{v}_1 - \mathbf{p})\cdot(\mathbf{v}_2 - \mathbf{p}). Nothing finite enters. So it survives the glass, and the figure runs it: the recovered focal length agrees with the true one to 4e-10 relative, out of a picture in which nothing is where it was.

The height recovery reads finite points. A height from one photograph is a cross-ratio along a vertical whose four points are the base, the horizon crossing, the top, and the vertical vanishing point — three of those are finite marks on the picture, and all three have moved.

A box drawn from a known camera, and the camera recovered from the drawingThree vanishing points found from the twelve drawn edges alone give back the focal length to 4e-15 relative.recovered principal pointused to drawrecoveredgapfocal length853.90853.904e-15principal x345.0345.02e-12angle44.0°44.0°—correct from 20 cm, at 160 mm wide44° across
Fig. 3 The recovery this essay puts through a pane of glass. It reads three vanishing points and nothing else, which is exactly why the glass cannot touch it — and why the same picture is useless for measuring a height off.

That split is not a curiosity. It is a practical rule for anyone reading geometry out of photographs: calibration survives a window; metrology does not. A photograph of a building taken through a train window will give up its focal length and its principal point correctly, and will give a wrong answer for how tall the building is. The two facts sit in the same picture and nothing in it distinguishes them.

How big is the effect, really

Honest arithmetic, because the figure had to be staged to make it visible.

The displacement a slab adds to the image is roughly proportional to t/zt/z — the thickness over the object’s distance — times the angular factor tan⁡θ−tan⁡θg\tan\theta - \tan\theta_g. A 6 mm domestic window pane with the scene four metres beyond it moves the picture by about half a pixel on a 690 px frame, which is nothing.

So the figure is a display case: 25 mm of laminated glass with the object standing right against the back of it, 0.2 to 0.9 m away. That is where the effect is real, and it is a real configuration — museum cases, aquarium fronts, thick shop windows with a display immediately behind.

Everything claimed here is equally true of the window across the room. It is just too small to draw, which is the honest reason the figure is set where it is.

The slider runs the thickness from 6 mm to 60 mm, and the point movement scales with it while the vanishing-point movement stays at the solver’s noise floor across the whole range. That is the shape of the claim: one quantity grows linearly, the other stays at zero.

The other thing the glass does

The slab preserves directions, and a picture is not made of directions alone. There is a second effect and it is worth being precise about, because it is the one that stops the glass being harmless.

The shift depends on the incidence angle, and the incidence angle for a point depends on where that point is and how far away it is. So two world points on one ray of the pinhole camera — the same image point, by definition of a projection — are displaced by different amounts and stop being the same image point. That is the general result from the previous essay and it applies here too.

So the through-glass picture is not a projection of the scene. It is not even a warp of the pinhole picture, because the correct warp would need a depth the picture does not carry. What it is, is a map that happens to be exact on the points at infinity, and those are precisely the points the camera recovery uses.

A family of parallel ground lines at 30°, and where they meetAll five lines pass through one point on the horizon, off the edge of the frame at x = 1192. The point fitted from the drawn lines agrees with the one computed from the direction to 4e-12 px, and the fit's own residual is 3e-13 px.horizon — the image of the line at infinityvanishing point at x = 1808 — off the framecorrect from 20 cm, at 160 mm wide44° across
Fig. 4 What a slab leaves untouched. A vanishing point is the image of a direction and nothing else, so a lateral shift that is a fixed length matters less and less as the point recedes, and not at all in the limit.

An aside on the case with water behind it

An aquarium front is glass with air in front and water behind, and it is worth being clear that none of this essay applies to it.

The slab argument needs the same medium on both sides. That is what makes the two refractions cancel in direction, and it is the whole result. With water behind, the second refraction is into a different index and the emergent ray is not parallel to the incident one — its direction has changed, permanently, by the amount the previous essay measured.

So the aquarium and the display case, which look like the same object, are on opposite sides of the field’s central divide. The case preserves every vanishing point exactly. The aquarium preserves none of them, and its picture has no station point at all. One pane of glass and one body of water; the glass is almost incidental in both.

That is the sort of distinction the layered solver makes easy to state and easy to get wrong by hand. The list of layers for a case is air, glass with air beyond; for an aquarium it is air, glass with water beyond. One symbol, and the entire result changes.

The straightness of a drawn edge

A related question worth answering rather than leaving implicit: does a straight world line still image as a straight line through the glass?

Not exactly. The displacement varies along the line, because the incidence angle and the distance both vary along it, so the image is very slightly curved. The figure’s edges are drawn from their endpoints, which is what a ruler does, and the vanishing point found by fitting those chords is not quite the exact one — it lands within about half the movement of the points themselves.

That is the practical version of the claim, and it is weaker than the exact one. The exact statement — vanishing points are preserved to the solver’s noise — is about the limit, and the limit is not something a reader with four short drawn edges can reach. What a reader with four edges gets is a vanishing point good to a fraction of a pixel where the finite points have moved by several. Good enough that a focal length recovered from a real photograph through a real window is right to well within its other uncertainties, and not the exact result the marching measurement gives.

Both are worth quoting and it matters which is which. The site’s habit is to state the exact result where there is one and the achievable result beside it, rather than letting a reader assume the second is the first.

The three vanishing points of one box, drawn to scale with the boxThe picture is the small rectangle. Two of the three vanishing points fall well outside it, which is why they are computed rather than located by eye.orthocentrethe pictureVP₁VP₂VP₃focal length from the triangle — 707.4 pxspread 0e+0% across three routes
Fig. 5 What the recovery reads, and the reason the glass cannot touch it: three points at infinity, their triangle, and its orthocentre. Not one finite mark of the scene enters this construction.

Where it shows up

Three places, and they are not exotic.

Museum and aquarium photography. A case front is thick and the subject is close, so the displacement is at its largest. A picture through one is fine to look at and wrong to measure from.

Windscreens and instrument covers. A camera behind a curved windscreen is not a slab problem at all — the surfaces are not parallel — and everything here fails to apply. A camera behind a flat instrument cover is exactly a slab problem, and the correction is a lateral shift that depends on the field angle.

Sensor cover glass. Every digital sensor sits behind a few millimetres of filter stack, and it is a plane-parallel slab. Its effect is absorbed into the lens design rather than corrected afterwards, which is why lenses computed for one sensor stack misbehave on another — an old and well-known problem with adapting lenses between systems, and it is this arithmetic, at a thickness of two or three millimetres and a very short distance.

What a reader can do about it

Suppose a photograph is known to have been taken through thick glass. What is recoverable?

The focal length and the principal point, to the accuracy the vanishing points allow. Run the recovery. Its own residuals say whether the bundles met; through a slab they meet nearly as well as they did in air, because the departure from straightness in each drawn edge is a fraction of a pixel over the edge’s length.

Angles at infinity. Anything that is a statement about directions: whether two walls are perpendicular, which way a street runs relative to the building on it, whether a drawing has two vanishing points or three.

Nothing that is a length or a ratio among finite points, without modelling the glass. If the thickness and the index and the standoff are known, the model is the layered solver in this field and it is invertible ray by ray, so the measurement can be recovered — but it is a ray-tracing problem, not a homography.

The awkward middle case is the common one: a photograph through glass of unknown thickness at an unknown standoff. There the honest answer is that the calibration is recoverable and the metrology is not, and no amount of care with the image changes that, because the missing information is a depth and the picture does not contain one.

Projective, affine, metric — what each stage buysThe photograph fixes the plane only up to a projectivity: the midpoint of a receding side lands 0.3970 of the way along. Supplying the plane's vanishing line buys the midpoint back exactly and nothing else. Supplying the image of one circle buys the last three numbers, at which point the right angle is 90.000° and two equal sides measure 1.000000. The cross-ratio is 1.333333 in all three, because it was never lost.projectiveaffinemetricmidpointtwo equal sidesa right anglecross-ratioprojective———1.333333333affine0.500000——1.333333333metric0.5000001.00000090.000°1.333333333— means the stage does not determine it at allcross-ratio 1.333333 throughout
Fig. 6 What is recoverable, graded. The photograph fixes the plane up to a projectivity and puts the midpoint of a receding side 0.3970 of the way along; the vanishing line buys the midpoint back; the image of a circle buys the right angle. Every purchase on that ladder is made out of directions, and directions are the thing the glass leaves alone — so a picture taken through a display case buys the whole ladder at the accuracy its own residuals report.

The pattern this is an instance of

Stand back from the three results and there is a shape to them.

Refraction through a stack destroys the property that made a picture a projection: the map stops being a function of direction alone. But different parts of the geometry depend on that property to different degrees, and the parts that depend only on the limit — on directions at infinity — are untouched, because a lateral shift is a length and a length is negligible at infinity.

So the general rule is: what a slab preserves is exactly what is defined at infinity. Vanishing points are. The horizon is, being the join of two of them. Parallelism is, and so is the classification of a drawing as one-, two- or three-point. What is not defined at infinity — a length, a ratio along a line, a cross-ratio of four finite points, the position of a mark — is moved.

That is a satisfying way to end up, because it is the same distinction the site’s first field is built on. A projection destroys length, angle, area and the ratio of lengths and preserves the cross-ratio, and the reason is that the first four are affine or metric properties and the last is a projective one. Here the split runs one level further out: the projective properties defined at infinity survive a slab, and the ones defined among finite points do not.

The next essay leaves slabs behind for the case where the far medium is not the near one, and the whole sky arrives inside a cone of 48.61°.

What links here

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

Reads more easily once this is understood

Essays that name this one as worth reading first.

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.

Camera calibrationFocal lengthLateral displacementPinholeplane-parallel plateRefractive indexVanishing point