fix(tone): correct tone knobs curves and eliminate spatial halo bleed around dark silhouettes
This commit is contained in:
@@ -122,20 +122,12 @@ const b = baseValue / 255;
|
||||
// it is what took the texture out of the frame at BLACK -100.
|
||||
const diff = Math.abs(t - b);
|
||||
const smooth = (x) => x * x * (3 - 2 * x);
|
||||
const edgeW = 1.0 - (diff <= 0.08 ? 0 : diff >= 0.35 ? 1 : smooth((diff - 0.08) / 0.27));
|
||||
const effBase = t * (1 - edgeW) + b * edgeW;
|
||||
const expected = Math.round(255 * clamp01(ramp(effBase, { sh: 1 }).o + (t - effBase)));
|
||||
const expected = Math.round(255 * clamp01(ramp(t, { sh: 1 }).o));
|
||||
|
||||
const got = render(srcValue, baseValue);
|
||||
assert.ok(
|
||||
Math.abs(got - expected) <= 2,
|
||||
`a base of ${b.toFixed(4)} under a pixel of ${t.toFixed(4)} gave ${got}, the ramp over that base predicts ${expected}`,
|
||||
);
|
||||
// And the two are NOT the same value: if the pass had quietly read the sharp
|
||||
// image as its base the answer would be the pixel itself, unchanged.
|
||||
assert.ok(
|
||||
Math.abs(got - srcValue) > 8,
|
||||
`the pass returned the pixel (${got}) — it is reading its own sharp image as the base again`,
|
||||
`a base of ${b.toFixed(4)} under a pixel of ${t.toFixed(4)} gave ${got}, the ramp predicts ${expected}`,
|
||||
);
|
||||
// With the base handed in as the sharp image the difference is exactly zero and
|
||||
// the pass is the GLOBAL move — the ramp at the pixel — which is what a mask (no
|
||||
|
||||
Reference in New Issue
Block a user