Diffusion Krita 7e3f6c7690b9

Add the latest lightness blending algorithm by Peter Schatz

Authored by dkazakov on Apr 3 2020, 9:32 AM.

Description

Add the latest lightness blending algorithm by Peter Schatz

"We needed a formula f(x) where f(0) = 0, f(1) = 1, and f(.5) = z,
where z is the lightness of the color chosen. This can’t be
linear unless the color chosen is also .5. So I went with
a quadratic equation and solved it.

f(x) = ax^2 + b^x +c
0,0 -> 0 = a0^2 + b0 + c -> c = 0
1,1 -> 1 = a1^2 +b1 + c -> 1 = a + b + 0 -> a = 1 - b
.5,z -> z = a*.5^2 + b*.5 + c -> z

= a/4 + b/2 + 0 -> z =
= 1/4 - b/4 + b/2 -> z = 1/4 + b/4 -> b = 4z - 1

f(x) = (1 - (4z - 1)) * x^2 + (4z - 1) * x

So yes, the equation will be different for every value of
color chosen, because that’s the only possible way to
achieve the goal of an equation that runs through (0,0),
(.5,z), and (1,1)."

Details

Committed
dkazakovApr 3 2020, 9:32 AM
Parents
R37:ddd2a774f2b4: Fix hiccups when zooming with a tablet
Branches
Unknown
Tags
Unknown