Name the channels in the shadow clipping warning too.
Shadow warnings were a flat blue, so a single crushed channel looked the same as all three. The shadow branch now uses the highlight palette: red/green/blue for one channel, yellow (red+green), magenta (red+blue) and cyan (green+blue) for pairs, white for all three. The render check covers both ends of the range, and `npm run predeploy` chains typecheck, tests, the render check and the build so a shader regression cannot reach a deploy. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -957,6 +957,7 @@ positions. Camera-lens defaults require both a normalised camera and lens name t
|
|||||||
| `npm run typecheck` | `tsc --noEmit` |
|
| `npm run typecheck` | `tsc --noEmit` |
|
||||||
| `npm test` | Vitest, one pass then exit |
|
| `npm test` | Vitest, one pass then exit |
|
||||||
| `npm run check:render` | Headless Chrome check that the 16-bit sidecar and JPEG proxy upload in the same row order |
|
| `npm run check:render` | Headless Chrome check that the 16-bit sidecar and JPEG proxy upload in the same row order |
|
||||||
|
| `npm run predeploy` | Typecheck, unit suite, render check, then build — run this before pushing a deploy |
|
||||||
|
|
||||||
Conventions worth knowing before changing code:
|
Conventions worth knowing before changing code:
|
||||||
|
|
||||||
@@ -998,7 +999,9 @@ beside the matching JPEG proxy and measures the rows that reach a WebGL2 texture
|
|||||||
headless Chrome. Then it renders that image through the real `Renderer` with the Ctrl
|
headless Chrome. Then it renders that image through the real `Renderer` with the Ctrl
|
||||||
clipping preview on, so the overlay has to paint red for one clipped channel and yellow
|
clipping preview on, so the overlay has to paint red for one clipped channel and yellow
|
||||||
for two instead of collapsing to white, and an unclipped band has to turn white once
|
for two instead of collapsing to white, and an unclipped band has to turn white once
|
||||||
Exposure is pushed past the top of the range. It fails on either regression, printing the
|
Exposure is pushed past the top of the range. The same run checks the shadow warning:
|
||||||
|
red for one channel at black, yellow for red+green, cyan for green+blue. `npm run
|
||||||
|
predeploy` chains it with the typecheck, unit suite and build. It fails on either regression, printing the
|
||||||
measured values, needs Chrome (`CHROME_PATH` overrides discovery) and skips with a notice
|
measured values, needs Chrome (`CHROME_PATH` overrides discovery) and skips with a notice
|
||||||
when none is installed.
|
when none is installed.
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"check:render": "node scripts/render-check.mjs",
|
"check:render": "node scripts/render-check.mjs",
|
||||||
|
"predeploy": "npm run typecheck && npm test && npm run check:render && npm run build",
|
||||||
"build:lens-db": "node scripts/build-lens-db.mjs"
|
"build:lens-db": "node scripts/build-lens-db.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -59,18 +59,24 @@ function spawnSyncOk(bin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Three horizontal bands. The first clips only red, the second clips red and
|
* Horizontal bands that exercise both ends of the range: one and two channels
|
||||||
* green (the yellow warning) and the third clips nothing, so the same image
|
* blown, one clean band, then one and two channels crushed, plus a green+blue
|
||||||
* also proves the clipping overlay still names the channels.
|
* crush to check the secondary colour. The same image proves the clipping
|
||||||
|
* overlay names the channels instead of painting every warning one colour.
|
||||||
*/
|
*/
|
||||||
|
const BANDS = [
|
||||||
|
[1.0, 0.55, 0.08], // highlight: red only
|
||||||
|
[1.0, 1.0, 0.08], // highlight: red + green (yellow)
|
||||||
|
[0.24, 0.28, 0.35], // nothing clipped
|
||||||
|
[0.0, 0.3, 0.35], // shadow: red only
|
||||||
|
[0.0, 0.0, 0.35], // shadow: red + green (yellow)
|
||||||
|
[0.3, 0.0, 0.0], // shadow: green + blue (cyan)
|
||||||
|
];
|
||||||
|
|
||||||
function buildSource() {
|
function buildSource() {
|
||||||
const rgb16 = new Uint16Array(W * H * 3);
|
const rgb16 = new Uint16Array(W * H * 3);
|
||||||
const rgb8 = new Uint8Array(W * H * 3);
|
const rgb8 = new Uint8Array(W * H * 3);
|
||||||
const bands = [
|
const bands = BANDS;
|
||||||
[1.0, 0.55, 0.08],
|
|
||||||
[1.0, 1.0, 0.08],
|
|
||||||
[0.24, 0.28, 0.35],
|
|
||||||
];
|
|
||||||
for (let y = 0; y < H; y++) {
|
for (let y = 0; y < H; y++) {
|
||||||
const band = bands[Math.min(bands.length - 1, Math.floor((y / H) * bands.length))];
|
const band = bands[Math.min(bands.length - 1, Math.floor((y / H) * bands.length))];
|
||||||
for (let x = 0; x < W; x++) {
|
for (let x = 0; x < W; x++) {
|
||||||
@@ -188,7 +194,7 @@ try {
|
|||||||
const viewGl = view.getContext('webgl2');
|
const viewGl = view.getContext('webgl2');
|
||||||
const sampleBand = (index) => {
|
const sampleBand = (index) => {
|
||||||
// readPixels rows start at the bottom, so flip the band centre.
|
// readPixels rows start at the bottom, so flip the band centre.
|
||||||
const py = h - 1 - Math.floor((h * (index + 0.5)) / 3);
|
const py = h - 1 - Math.floor((h * (index + 0.5)) / ${BANDS.length});
|
||||||
const px = new Uint8Array(4);
|
const px = new Uint8Array(4);
|
||||||
viewGl.readPixels(Math.floor(w / 2), py, 1, 1, viewGl.RGBA, viewGl.UNSIGNED_BYTE, px);
|
viewGl.readPixels(Math.floor(w / 2), py, 1, 1, viewGl.RGBA, viewGl.UNSIGNED_BYTE, px);
|
||||||
return [px[0], px[1], px[2]];
|
return [px[0], px[1], px[2]];
|
||||||
@@ -207,6 +213,10 @@ try {
|
|||||||
renderer.render(brightEdits, { width: w, height: h, clipPreview: true });
|
renderer.render(brightEdits, { width: w, height: h, clipPreview: true });
|
||||||
const brightPixel = sampleBand(2);
|
const brightPixel = sampleBand(2);
|
||||||
|
|
||||||
|
// Shadow clipping: same palette at the other end of the histogram.
|
||||||
|
renderer.render(defaultEdits(), { width: w, height: h, clipping: 'shadows' });
|
||||||
|
const shadowPixels = [2, 3, 4, 5].map(sampleBand);
|
||||||
|
|
||||||
pre.textContent = 'RESULT ' + JSON.stringify({
|
pre.textContent = 'RESULT ' + JSON.stringify({
|
||||||
clipPixels,
|
clipPixels,
|
||||||
clipRed: near(clipPixels[0], RED_MARK),
|
clipRed: near(clipPixels[0], RED_MARK),
|
||||||
@@ -217,6 +227,12 @@ try {
|
|||||||
!near(clipPixels[2], [255, 255, 255]),
|
!near(clipPixels[2], [255, 255, 255]),
|
||||||
clipFollowsExposure: near(brightPixel, [255, 255, 255]),
|
clipFollowsExposure: near(brightPixel, [255, 255, 255]),
|
||||||
brightPixel,
|
brightPixel,
|
||||||
|
shadowPixels,
|
||||||
|
shadowClear:
|
||||||
|
!near(shadowPixels[0], RED_MARK) && !near(shadowPixels[0], YELLOW_MARK),
|
||||||
|
shadowRed: near(shadowPixels[1], RED_MARK),
|
||||||
|
shadowYellow: near(shadowPixels[2], YELLOW_MARK),
|
||||||
|
shadowCyan: near(shadowPixels[3], [26, 217, 255]),
|
||||||
flagHonouredForBitmap: !same(proxyTop, proxyNoFlipTop),
|
flagHonouredForBitmap: !same(proxyTop, proxyNoFlipTop),
|
||||||
proxyTop: +proxyTop.toFixed(4),
|
proxyTop: +proxyTop.toFixed(4),
|
||||||
sidecarTop: +sideTop.toFixed(4),
|
sidecarTop: +sideTop.toFixed(4),
|
||||||
@@ -364,6 +380,12 @@ async function main() {
|
|||||||
` clear=${JSON.stringify(result.clipPixels[2])}` +
|
` clear=${JSON.stringify(result.clipPixels[2])}` +
|
||||||
` | at +6EV the clear band is ${JSON.stringify(result.brightPixel)}`,
|
` | at +6EV the clear band is ${JSON.stringify(result.brightPixel)}`,
|
||||||
);
|
);
|
||||||
|
console.log(
|
||||||
|
`render check: shadow overlay clear=${JSON.stringify(result.shadowPixels[0])}` +
|
||||||
|
` red=${JSON.stringify(result.shadowPixels[1])}` +
|
||||||
|
` yellow=${JSON.stringify(result.shadowPixels[2])}` +
|
||||||
|
` cyan=${JSON.stringify(result.shadowPixels[3])}`,
|
||||||
|
);
|
||||||
if (!result.matchTop || !result.matchBottom) {
|
if (!result.matchTop || !result.matchBottom) {
|
||||||
console.error(
|
console.error(
|
||||||
result.reversed
|
result.reversed
|
||||||
@@ -379,6 +401,14 @@ async function main() {
|
|||||||
);
|
);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (!result.shadowClear || !result.shadowRed || !result.shadowYellow || !result.shadowCyan) {
|
||||||
|
console.error(
|
||||||
|
'render check FAILED: the shadow clipping overlay lost its channel colours ' +
|
||||||
|
`(clear=${result.shadowClear}, red=${result.shadowRed}, ` +
|
||||||
|
`yellow=${result.shadowYellow}, cyan=${result.shadowCyan}).`,
|
||||||
|
);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (!result.clipFollowsExposure) {
|
if (!result.clipFollowsExposure) {
|
||||||
console.error(
|
console.error(
|
||||||
'render check FAILED: the clipping overlay does not follow Exposure; ' +
|
'render check FAILED: the clipping overlay does not follow Exposure; ' +
|
||||||
|
|||||||
+18
-3
@@ -855,9 +855,24 @@ void main(){
|
|||||||
// the finished frame rather than the source, so holding Ctrl while moving
|
// the finished frame rather than the source, so holding Ctrl while moving
|
||||||
// Exposure or Recovery shows the warnings appear and clear as you go.
|
// Exposure or Recovery shows the warnings appear and clear as you go.
|
||||||
if (u_clip > 1.5) {
|
if (u_clip > 1.5) {
|
||||||
// Shadow clipping: everything that has fallen to the bottom of the range.
|
// Shadow clipping: which channels have fallen to the bottom of the range.
|
||||||
if (max(finalCol.r, max(finalCol.g, finalCol.b)) < 0.02) {
|
// The palette mirrors the highlight one, so red/green/blue mean one channel
|
||||||
finalCol = vec3(0.15, 0.4, 1.0);
|
// and the secondary colours name the pair that ran out of shadow detail:
|
||||||
|
// yellow red+green, magenta red+blue, cyan green+blue.
|
||||||
|
vec3 k = 1.0 - step(vec3(0.021), finalCol);
|
||||||
|
float n = k.r + k.g + k.b;
|
||||||
|
if (n > 0.5) {
|
||||||
|
vec3 mark = vec3(1.0);
|
||||||
|
if (n < 2.5) {
|
||||||
|
if (n > 1.5) {
|
||||||
|
if (k.r > 0.5 && k.g > 0.5) mark = vec3(1.0, 0.9, 0.1);
|
||||||
|
else if (k.r > 0.5) mark = vec3(1.0, 0.15, 0.85);
|
||||||
|
else mark = vec3(0.1, 0.85, 1.0);
|
||||||
|
} else if (k.r > 0.5) mark = vec3(1.0, 0.12, 0.12);
|
||||||
|
else if (k.g > 0.5) mark = vec3(0.1, 1.0, 0.2);
|
||||||
|
else mark = vec3(0.15, 0.4, 1.0);
|
||||||
|
}
|
||||||
|
finalCol = mark;
|
||||||
}
|
}
|
||||||
} else if (u_clip > 0.5) {
|
} else if (u_clip > 0.5) {
|
||||||
vec3 k = step(0.985, finalCol);
|
vec3 k = step(0.985, finalCol);
|
||||||
|
|||||||
Reference in New Issue
Block a user