What a camera does

Filling in a highlight is a claim about the surface

A converter that rebuilds a clipped channel has to say what the highlight was. A matt surface over-exposed keeps its own colour, and filling the lost channel from that colour is exact. A glossy highlight is the surface's colour plus a reflection of the lamp, and the same fill leaves it 7.6 colour differences too colourful — while a fill that solves for surface and lamp is exact. Neither works once two channels are clipped, and a tungsten lamp keeps a highlight in the one-channel band more than twice as long as daylight does.

Assumes Two converters and one highlight, A blown highlight turns and The highlight is the lamp.

Two converters and one highlight measured where a raw converter clips a highlight and found the two defensible placements twenty-one colour differences apart. It said plainly what it had left out: no highlight reconstruction was modelled, and every serious converter attempts one. A reconstruction puts a number back where a raw channel stopped counting. The number has to come from somewhere, and where it comes from is an assumption about what kind of surface the highlight is on.

Four ways to fill in a clipped highlight: a glossy surface with a reflection of the lamp, under tungsten. Twenty-four chart surfaces under tungsten, as a glossy surface with a reflection of the lamp, taken up a ramp until their raw channels reach the sensor's ceiling. Each line is the mean colour difference, at equal lightness, between the true colour and what one response to the clipped reading makes of it: clipping to white, carrying the clipped values through, filling the clipped channel from the surface's own ratio, and filling it from the surface's colour plus the lamp's. At 0.4, where most surfaces have one channel clipped, the four leave 5.87, 4.37, 5.56, 0.00; at 2, 2.90, 26.97, 8.18, 8.18.
Fig. 1 Twenty-four chart surfaces under a tungsten lamp, each as a glossy highlight whose reflection of the lamp grows until the raw channels clip, with four responses to the clipped reading. One of them is exact until a second channel clips.

The fill is right when the model is

A reconstruction is exact when its model of the highlight is the right one and enough channels survive to feed it, and several colour differences wrong otherwise — and which highlights the right model can reach is decided by the lamp.

  • An over-exposed matt surface keeps its colour, and filling the clipped channel from that colour is exact with one or two channels clipped.
  • A glossy highlight adds a reflection of the lamp, and the same fill leaves it a mean of 7.6 colour differences off with one channel clipped under tungsten. Solving for the surface’s colour and the lamp’s together is exact there.
  • With two channels clipped on a glossy highlight neither fill has enough to work with: both leave 8.6. Clipping to white leaves 3.7, the best of the four.
  • Under tungsten a highlight climbs a mean of 0.86 stops with only one channel clipped; under daylight 0.39.

Why a clipped channel needs a model

A photosite whose well has filled reports the same number for any greater light, so the reading is not a measurement of the highlight but a floor under it. Of all the decisions raw is not a picture leaves to a converter, this is the one where the converter has to supply data rather than choose an operation. A blown highlight turns because the channels that are still counting carry on climbing and the one that stopped does not, and the ratio between them — which is all colour ever is in a raw file — drifts towards whatever is still rising.

A converter has two things it can do with no model at all. It can clip every channel to the level of the lowest ceiling after the white balance, which sends a highlight towards neutral; or it can carry the clipped readings through unchanged, which keeps the drift. Either is a statement about the highlight made by not making one, and the placement between them is what the earlier essay priced.

Anything better has to supply the missing reading, and a missing reading can only be supplied from something known. What is known is the channels that are still counting and what is around the highlight — the same surface a little further from the brightest point, where nothing clipped. What connects the two is a model of how a surface’s colour changes as the light on it rises, and there are two physically different such models.

A matt surface is its own colour, brighter

A matt surface returns light by scattering it inside the paint, so every photon it returns has met the pigment. Brighter light on it is the same spectrum scaled, and its three raw readings keep the ratio they had in the shade. The unclipped surroundings supply that ratio, the channels still counting supply the level, and the clipped channel follows — one open channel is enough.

Four ways to fill in a clipped highlight: a matt surface over-exposed, under tungsten. Twenty-four chart surfaces under tungsten, as a matt surface over-exposed, taken up a ramp until their raw channels reach the sensor's ceiling. Each line is the mean colour difference, at equal lightness, between the true colour and what one response to the clipped reading makes of it: clipping to white, carrying the clipped values through, filling the clipped channel from the surface's own ratio, and filling it from the surface's colour plus the lamp's. At 1, where most surfaces have one channel clipped, the four leave 6.12, 0.00, 0.00, 0.00; at 4, 10.99, 33.33, 4.29, 4.29.
Fig. 2 The same twenty-four surfaces as over-exposed matt highlights under tungsten. Filling from the surface’s ratio is exact while at least one channel is counting; clipping to white and carrying the clipped values are several colour differences off from the first clipped step.

Under tungsten, filling from the surface’s ratio is exact on every surface at every exposure until a surface has clipped all three channels. At two and a half times the exposure that first clips, carrying the clipped values through leaves a mean of 28.4 colour differences and clipping to white 11.0; the ratio fill leaves none. The fill that solves for surface and lamp is exact too, because a matt highlight is a special case of its model with no lamp in it.

That is the case highlight reconstruction is usually demonstrated on, and it is the easy one. Nothing about it tells a converter whether the highlight in front of it is matt.

A glossy highlight is the lamp arriving

A glossy surface returns light two ways — which is why gloss changes the measurement of its colour. Some enters the paint and scatters out coloured; some reflects at the surface before it enters, the same reflection that takes colour out of a bounce in a glossy room, and the highlight is the lamp — that part carries the lamp’s spectrum almost unchanged, because the reflectance of a clear interface barely varies with wavelength. A glossy highlight is therefore the surface’s colour plus a growing amount of the lamp’s, and as it brightens its colour moves from the paint’s towards the light’s.

One surface's highlight, and what each response makes of its chroma — gloss, tungsten. Chart surface 21 of twenty-four as a glossy surface with a reflection of the lamp under tungsten. The heavy line is the true chroma at equal lightness as the ramp rises; the others are the four responses to the clipped reading. The first channel reaches the ceiling at 0.30 and the second at 1.40. At the top of the ramp the true chroma is 40.7 and the four give 37.9, 29.7, 52.6, 52.6.
Fig. 3 One saturated surface’s glossy highlight under tungsten. Its true chroma falls as the lamp’s reflection grows. The fill from surface and lamp follows it exactly until the second channel clips; the fill from the surface’s ratio holds the paint’s chroma the whole way.

Filling a glossy highlight from the surface’s ratio assumes the highlight is still the surface’s colour, so it restores the paint’s chroma to a highlight that has lost part of it. On the saturated surface above, the true chroma at equal lightness falls from 52.6 to 42.1 as the reflection grows to 1.2 times the lamp’s own level; the ratio fill stays at 52.6. Carrying the clipped readings through wanders between 38 and 43 as the channels reach the ceiling in turn, and clipping to white holds it at 37.9. Only one response follows the truth.

That response writes each channel still counting as an unknown amount of the surface’s colour plus an unknown amount of the lamp’s, which is the dichromatic model of a highlight that is the white balance turned to a different use. The surface’s colour comes from the unclipped surroundings and the lamp’s from the white balance, so two channels still counting give two equations in the two unknowns, and the third channel follows exactly.

Sorted by what survived

The ramps mix surfaces that clip one channel at a time with surfaces that clip two at once. Sorting every surface at every step by how many channels it had clipped separates what each fill can and cannot do.

The same highlights, sorted by how many channels were clipped — gloss, tungsten. Every surface at every level of the ramp for a glossy surface with a reflection of the lamp under tungsten, grouped by whether one, two or three raw channels had reached the ceiling. The bars are each response's mean colour difference from the true colour in that group. With one channel clipped (86 cases) the fill from surface and lamp is exact and the fill from the surface's ratio leaves 7.64. With two (58 cases) they leave 8.62 and 8.62.
Fig. 4 Every glossy highlight under tungsten grouped by one, two or three clipped channels, with each response’s mean error. With one clipped, the fill from surface and lamp is exact; with two, it has one equation for two unknowns and does no better than the ratio.

With one channel clipped — 86 cases under tungsten — the fill from surface and lamp is exact on every one, the ratio fill leaves a mean of 7.64 and a worst of 13.7, carrying the clipped value 11.9 and clipping to white 5.57. Under daylight the one-channel cases number only 31, and the fill from surface and lamp is exact on all of them too, while the ratio fill leaves 8.69.

With two channels clipped — 58 cases — there is one reading left for two unknowns. The fill from surface and lamp cannot separate how much of the reading is paint and how much is lamp, falls back on the surface’s ratio, and both leave 8.62. Clipping to white leaves 3.69, the best of the four, because a glossy highlight bright enough to clip two channels really is mostly lamp, and the lamp is white after the balance. With all three channels clipped nothing is left at all.

On a matt highlight the count runs differently: the ratio fill is exact with two channels clipped as well, because a matt surface needs only one channel to fix its level. A matt highlight needs one reading and its surroundings; a glossy one needs two readings, its surroundings and the lamp.

The lamp decides how much can be rebuilt

Every exact result above lives in a band — the exposures at which a highlight has clipped one channel and not yet a second. How wide that band is depends on how far apart the three raw channels sit, and that is set by the lamp.

How far a highlight climbs with only one channel clipped, under two lamps. For each of twenty-four chart surfaces as an over-exposed matt highlight, the exposure range in stops between its first raw channel reaching the ceiling and its second — the range in which a reconstruction still has two readings to work from. Under daylight the mean is 0.39 stops and the median 0.35; under tungsten 0.86 and 0.88. The lamp's raw white is 1.00, 0.86, 0.54 under daylight and 1.00, 0.55, 0.16 under tungsten: the further apart it puts the channels, the longer one of them clips alone.
Fig. 5 For each chart surface as an over-exposed matt highlight, the range in stops between its first and second channel clipping, under daylight and under tungsten. Tungsten’s spread of raw channels gives every surface a wider band.

A white balance exists because a sensor responds unequally to a lamp’s light, and the inequality is the spread. Under daylight this sensor’s raw white is 1.00, 0.86 and 0.54 across its three channels; under tungsten, 1.00, 0.55 and 0.16. A surface under tungsten reaches its second channel’s ceiling a long way after its first, because the lamp starves the other channels. The mean band is 0.86 stops under tungsten and 0.39 under daylight, with a median of 0.88 against 0.35, and on the least favourable surface under daylight it is two hundredths of a stop — the two channels clip together.

So the same reconstruction, run on the same scene, can rebuild more than twice as much of a highlight’s exposure range indoors under tungsten as outdoors in daylight. That runs against expectation, because daylight is the easy light for almost everything else a camera does. It is easy because it fills the three channels evenly, and a highlight in evenly filled channels loses them together.

The exact fill is the noisy one

A fill is exact on a model and a model is exact on noiseless readings. The two channels still counting carry noise, and each fill passes some of it into the channel it writes.

How much of the open channels' noise each fill writes into the clipped one, under tungsten. For each of twenty-four chart surfaces under tungsten, with its strongest raw channel clipped and the other two counting: the factor by which noise in the two open channels reaches the filled channel, on a logarithmic scale, against the angle between the surface's and the lamp's readings in those two channels. The ratio fill's median factor is 4.13 and the fill from surface and lamp's 7.03. On the surface whose open channels are nearest the lamp's balance, 0.03° away, the second is 840.2: paint and lamp cannot be told apart in two readings that hold the same balance.
Fig. 6 For each chart surface under tungsten with its strongest channel clipped, how many times the noise in the other two channels reaches the filled one, against how close the surface’s balance is to the lamp’s in those two channels. The fill from surface and lamp is the noisier, and without limit where the two balances meet.

Under tungsten the ratio fill passes a median of 4.1 times the open channels’ noise into the filled channel, and the fill from surface and lamp 7.0 times. Under daylight the two medians are 1.4 and 2.8. The ratio fill scales two readings by the surface’s own ratio, and under tungsten the readings it scales are the green and blue a warm lamp starves, so a small reading’s noise is multiplied up to fill a large channel. The dichromatic fill does that and more: it separates two colours using two readings, and separating two nearly parallel directions multiplies whatever error the readings carry.

What makes it worst is not how alike the surface and the lamp look but how alike they are in the two channels still counting. On one surface under tungsten whose green and blue readings hold the lamp’s own balance to three hundredths of a degree the fill multiplies noise 840 times, while the surface whose overall colour is nearest the lamp’s passes on 1.7 times, because its open channels differ. Across the twenty-four surfaces the multiplier’s rank correlation with the angle between the two balances in the open channels is −0.82 under tungsten and −0.87 under daylight. On such a surface a matt highlight and a glossy one give exactly the same two readings, so there is nothing for the fill to separate; the sensible response is the ratio fill, which the two models agree on there.

So the lamp that widens the band also thins what the band is built from. Tungsten gives a highlight more than twice daylight’s exposure range with one channel clipped and passes on between two and a half and three times daylight’s noise into whatever fills it — the arithmetic by which correcting colour costs noise, arriving in a channel nothing measured. A fill’s noise is also not the zero-mean noise a later average removes once a clip has been involved, as clipped noise does not average away found at the other end of the range: a filled channel written as at least the ceiling has its noise cut off from below.

Under daylight, the band is where the difference is

The daylight ramp shows the narrow band in practice.

Four ways to fill in a clipped highlight: a glossy surface with a reflection of the lamp, under daylight. Twenty-four chart surfaces under daylight, as a glossy surface with a reflection of the lamp, taken up a ramp until their raw channels reach the sensor's ceiling. Each line is the mean colour difference, at equal lightness, between the true colour and what one response to the clipped reading makes of it: clipping to white, carrying the clipped values through, filling the clipped channel from the surface's own ratio, and filling it from the surface's colour plus the lamp's. At 0.4, where most surfaces have one channel clipped, the four leave 8.74, 5.32, 6.57, 0.60; at 2, 5.64, 19.02, 5.64, 5.64.
Fig. 7 The glossy ramp under daylight. The fill from surface and lamp is nearly exact at the first clipped step and joins the ratio fill one step later, because most surfaces have clipped a second channel by then.

At a reflection four tenths of the lamp’s level, with most surfaces clipped in one channel, the fill from surface and lamp leaves 0.60 and the ratio fill 6.57. By 0.7 most surfaces have clipped a second channel, and the two leave 7.74 each. Clipping to white leaves 9.78 there and carrying the clipped values 15.65. The model that is exact under tungsten across three steps of the ramp is nearly exact under daylight at one, and only because a few surfaces there have already clipped a second channel.

Two clipped channels under daylight are a common state rather than an edge case: 60 of the ramp’s cases have two, 53 have three and only 31 have one.

What the placement was measuring

The earlier essay compared clipping at the sensor with clipping after the matrix and found them twenty-one colour differences apart at the worst. Those are two of the four responses here, the two without a model.

The same highlight, clipped in two places. A ramp running from inside the sensor's range to 1.6 times over it, clipped at the sensor and clipped after the matrix. Below the ceiling the two are identical to the floating-point floor. Above it they part, reaching 21.0 colour differences and 78 degrees of hue. Clipping late keeps a highlight neutral and clipping early keeps its hue, and converters do both.
Fig. 8 The two placements of the clip from the essay on two converters, on a ramp from inside the sensor’s range to well over it. Neither fills anything in; their disagreement is what a reconstruction is meant to settle.

A reconstruction does narrow that gap, and only on the highlights its model fits. On glossy highlights under tungsten with one channel clipped, the fill from surface and lamp removes the whole of what the placements disagree about, and the ratio fill replaces it with an over-coloured highlight of its own. On a matt surface the ratio fill removes it with one channel counting or two. On any highlight with all its channels clipped, every placement and every fill is the same white. The disagreement between converters that the earlier essay attributed partly to reconstruction is, more exactly, a disagreement about which surfaces highlights are on.

The luminance is a separate matter and every response underestimates it. Clipping to white on a glossy tungsten highlight at twice the lamp’s level loses 1.44 stops; on the same ramp the fills stay within a sixth of a stop, and on a matt surface clipped in all three channels they lose two thirds of one, because a filled channel is set by a model and a model’s level is only as good as the channels it read.

Telling the surfaces apart

The choice between the two models can be made from the image, because the two kinds of highlight leave different traces in the pixels around them.

A matt highlight keeps its chromaticity from the shade to the clipping point; a glossy one moves towards the lamp’s as it brightens. Before any channel clips, the unclipped approach to a highlight already shows which is happening: the ratio of the channels either holds or slides towards the white balance’s ratio. A converter could read that slide on the way up and choose the dichromatic fill where it sees one and the ratio fill where it does not.

It could also be wrong. A matt surface whose colour genuinely varies across the highlight — a gradient in the paint, a fold in fabric — slides for reasons that have nothing to do with the lamp, and an image does not determine the light in general, let alone the surface under it. Whichever it chooses, a fill needs to know which channels stopped counting, and a converter knows that only while it still holds the raw readings and the sensor’s white level — so the fill has to run before anything clamps, the placement one step has no choice and the order is not in the documentation found unrecorded for every other operation in the chain.

What a converter cannot do is make no claim. Clipping to white claims a highlight is entirely lamp; carrying the readings claims nothing is missing; each fill claims a model. The one it chooses should be the one its evidence supports, and a file that recorded the choice would let a later edit revise it.

How the highlights were computed

The camera is the modelled raw pipeline of the essays on raw conversion: a silicon sensor with dye filters and an infrared-cut filter, a white balance by the lamp’s raw white, and a colour matrix fitted to a chart. The ceiling is one level in counts for all three channels, placed where the lamp’s own white reaches it in its strongest channel.

The surfaces are twenty-four constructed chart reflectances. A matt highlight is the surface’s raw reading scaled so that its strongest channel reaches the ceiling at an exposure of one. A glossy highlight is the surface’s reading at seven tenths of the ceiling plus the lamp’s own raw white scaled by the reflection’s strength, so a strength of one puts the lamp’s strongest channel at the ceiling. The fills take the surface’s colour from its unclipped reading. Colours are compared at equal lightness — the delivered linear values’ chromaticity scaled to an eighteen per cent grey’s luminance — in ΔE₀₀, and luminance errors separately in stops.

What the model assumes

The surroundings are assumed to give the surface’s true colour and the white balance the lamp’s. A real converter estimates both, from pixels that carry noise and from a white balance that may be wrong, and each estimate’s error passes straight into the fill. The fills are exact here in the way a model is exact on the data it describes.

The glossy highlight’s reflection is taken as exactly the lamp’s colour. A real interface’s reflectance varies by a few per cent across the band, and a metal’s reflection is coloured by the metal, which puts metals outside both models.

And the ceiling is the same in all three channels. Real sensors saturate at different levels per channel and a raw file’s recorded white level is not always where the well filled, which moves the band’s edges without changing what happens inside it.

The habit: a missing value is filled by a model whether or not one is named

Every method of putting a value where a measurement stopped assumes something about what the measurement would have been. Zero, the last good value, a ratio, an interpolation: each is a model, and the ones that look like no model at all — clip it, carry it — are the ones whose assumptions are least examined.

The move is to write down which kind of object the fill is right for, check that the object in hand is that kind, and count how many independent readings the model needs against how many survive.

The failure mode is to demonstrate a fill on the case its model fits and ship it for every case. A fill tested on matt highlights has been tested on the highlights that need it least, and a glossy highlight under daylight is the ordinary case where it is wrong.

Where reconstruction comes from

Highlight reconstruction in raw converters goes back to the early open-source raw decoders, which offered modes for clipping, blending towards white and rebuilding a channel from its neighbours’ ratios, and it is a standard feature of every current converter. The dichromatic reflection model is Shafer’s, from 1985, and is the basis of a large literature on separating specular and diffuse reflection in images.

That a fill from surface and lamp is exact on glossy highlights with one channel clipped and a ratio fill is not, that neither survives a second clipped channel, and that the lamp’s spread of raw channels sets how much of a highlight’s range can be rebuilt, are computed here on one modelled sensor.

Still open: whether a converter can read the slide

The choice between the models rests on seeing whether a highlight’s chromaticity slides towards the lamp’s on its way up. How reliably that slide can be measured from real pixels — through noise, through the sensor’s own mosaic, and on surfaces whose colour varies across the highlight for reasons of their own — and how often a converter reading it would choose the wrong model, is a question about real images rather than about the arithmetic, and it would say whether a converter can choose its fill surface by surface or only once per picture.

What this makes readable

Essays that name this one as a prerequisite.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the index of named objects makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

Camera rawClippingDeclared inputDichromatic modelDynamic rangeExposureHighlight recoverySpecularStructural choiceWhite balance