Make lens-profile vignetting correction opt-in.
Applying a profile used to enable distortion, CA and vignetting together, and the flat-field gain lifts the already tone-mapped corners above the frame centre, over-exposing the edges. Vignetting now defaults off when a profile is applied or restored from a camera default, and only turns on when a profile explicitly stored vignetting: true.
This commit is contained in:
@@ -2028,7 +2028,10 @@ export function OpticsPanel({
|
|||||||
model: result.model,
|
model: result.model,
|
||||||
crop: result.crop,
|
crop: result.crop,
|
||||||
cameraModel: photo.meta.camera ?? undefined,
|
cameraModel: photo.meta.camera ?? undefined,
|
||||||
corrections: { distortion: true, tca: true, vignetting: true },
|
// Geometry and CA are safe to correct on their own; the vignetting gain
|
||||||
|
// lifts the corners above the frame centre, so it is left for the user to
|
||||||
|
// enable on the profile they applied.
|
||||||
|
corrections: { distortion: true, tca: true, vignetting: false },
|
||||||
distance: 1000,
|
distance: 1000,
|
||||||
};
|
};
|
||||||
set({ lens: next }, 'Lens profile');
|
set({ lens: next }, 'Lens profile');
|
||||||
|
|||||||
+5
-1
@@ -421,7 +421,11 @@ function lensProfile(input: unknown): LensProfile | undefined {
|
|||||||
corrections: {
|
corrections: {
|
||||||
distortion: corrections?.distortion !== false,
|
distortion: corrections?.distortion !== false,
|
||||||
tca: corrections?.tca !== false,
|
tca: corrections?.tca !== false,
|
||||||
vignetting: corrections?.vignetting !== false,
|
// The vignetting map is a flat-field gain applied to the already
|
||||||
|
// tone-mapped proxy, which pushes the corners brighter than the frame
|
||||||
|
// centre and over-exposes the edges. It stays opt-in, so a profile saved
|
||||||
|
// without an explicit flag never brightens the corners.
|
||||||
|
vignetting: corrections?.vignetting === true,
|
||||||
},
|
},
|
||||||
distance: num(raw.distance, 1000, 0.1, 100000),
|
distance: num(raw.distance, 1000, 0.1, 100000),
|
||||||
};
|
};
|
||||||
|
|||||||
+4
-1
@@ -85,7 +85,10 @@ function editsForImport(meta: PhotoMeta, defaults: CameraLensDefault[]) {
|
|||||||
if (match) {
|
if (match) {
|
||||||
edits.lens = {
|
edits.lens = {
|
||||||
...match.profile,
|
...match.profile,
|
||||||
corrections: { ...match.profile.corrections },
|
// A saved default still carries whatever the profile had when it was
|
||||||
|
// stored. Applying it on import must not switch the vignetting gain back
|
||||||
|
// on and over-expose the corners, so that correction stays opt-in.
|
||||||
|
corrections: { ...match.profile.corrections, vignetting: false },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return edits;
|
return edits;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { normalizeEdits } from './edits';
|
||||||
import { defaultForMeta, type CameraLensDefault } from './lensDefaults';
|
import { defaultForMeta, type CameraLensDefault } from './lensDefaults';
|
||||||
import type { LensProfile } from '../types';
|
import type { LensProfile } from '../types';
|
||||||
|
|
||||||
@@ -64,4 +65,20 @@ describe('camera-lens default selection', () => {
|
|||||||
).toBe(newer);
|
).toBe(newer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('leaves the vignetting correction off unless the profile asked for it', () => {
|
||||||
|
// Older saved profiles carry no corrections block at all; the flat-field
|
||||||
|
// gain would brighten the corners past the frame centre if it defaulted on.
|
||||||
|
const legacy = normalizeEdits({ lens: { maker: 'Nikon', model: 'Nikkor 50mm', crop: 1 } } as never);
|
||||||
|
expect(legacy.lens?.corrections).toEqual({ distortion: true, tca: true, vignetting: false });
|
||||||
|
|
||||||
|
const optedIn = normalizeEdits({
|
||||||
|
lens: {
|
||||||
|
maker: 'Nikon',
|
||||||
|
model: 'Nikkor 50mm',
|
||||||
|
crop: 1,
|
||||||
|
corrections: { distortion: true, tca: true, vignetting: true },
|
||||||
|
},
|
||||||
|
} as never);
|
||||||
|
expect(optedIn.lens?.corrections.vignetting).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user